Many people would like to integrate Paid Memberships Pro with Gravity Forms. While we don’t have a tight integration available at this time, below is a simple code example that you can use to trigger a user’s membership level change as part of a Gravity Form submission.

Some things to consider…

  • This method will rely solely on the form requiring a user to be logged in, or that the form is a “user registration” form using the Gravity Forms user registration add on.
  • If your level is a paid level, you will need all of the appropriate subscription and gateway add ons for Gravity Forms. This method will not use the level’s Billing Details set up in PMPro. We’d advise only doing this if your level is free or simply a one time payment.
  • The payments will not show up as “orders” in Paid Memberships Pro, nor will they be part of your “Reports” in Paid Memberships Pro. The invoice records will all be stored in Gravity Forms admin pages, and the user’s Membership Account page will have no record of payment.

So this is a very specific use case, but it gives you an idea of how you might want to integrate with Gravity Forms… so here it is:

Gravity PMP by Ristretto Apps

You can also integrate Gravity Forms with Paid Memberships Pro by using the Gravity PMP plugin by Ristretto Apps. This premium plugin integration can give you a highly customizable registration, allows multiple level registration simultaneously, donations of any amount and multiple gateway support.

View Premium Plugin

This entry was posted by Kimberly Coleman in General and tagged . Bookmark the permalink. Last updated: April 1, 2014. Titled Assign or change a user’s membership level on Gravity Form submission

Comments (37)

I’m hoping to use something like this to auto-assign new users to a PMP group upon registration. I want to hide membership levels from the registration page and will use Gravity Forms with User Registration and a third-party plugin that allows registrations only with invitation codes for the registration process. Once registered, users should be added to a group (or membership level if that’s easier) based on the beginning characters of the invitation code. If I sign up for PMP paid support is this something you can help with?

I’m building a payment plugin.
I’ve not been able to change membership level after processing payments, I need help.

My website was not adding the user level using the code above. I could not determine why – but assume that there is a plugin conflict. I worked out this alternative code below that does work:

// only fires when GF form with Register User addon is configured is submitted
add_action(‘gform_user_registered’, ‘pmpro_membeer_level_after_gform_user_registered’, 10, 2);
function pmpro_membeer_level_after_gform_user_registered( $user_id )


if( $_POST[‘gform_submit’] == 1 ){ // when the form with ID X is submitted
pmpro_changeMembershipLevel( 4, $user_id ); // set the membership level


Anyone wanting to know how to assign a membership level on new account creation through GravityForms, just paste the following into your themes functions.php

/* ————————————————————
————————————————————— */
add_action(‘user_register’, ‘kleo_pmpro_default_level’);
function kleo_pmpro_default_level($user_id) {

Hi, I am using paid membership pro, theme my login and Gravity Forms with “User registration” add-on.

My subscription form are created with Gravity Forms. My users can subscribe with no problem but when they want to login (the login page just contain the theme my login shortcode), they arrive on a error 500 page (but if they refresh the error 500 page they finally arrive on the good page).

Below the error i found in my error log files (the first line is when the user created is account), next lines are when he try to login :

[13-Oct-2017 09:31:10 UTC] PHP Warning: Creating default object from empty value in /home/rciziapqb/public_html/wp-content/plugins/pmpro-register-helper/pmpro-register-helper.php on line 578
[13-Oct-2017 09:39:58 UTC] PHP Warning: Illegal string offset ‘last’ in /home/rciziapqb/public_html/wp-content/plugins/paid-memberships-pro/adminpages/reports/login.php on line 402
[13-Oct-2017 09:39:58 UTC] PHP Warning: Illegal string offset ‘alltime’ in /home/rciziapqb/public_html/wp-content/plugins/paid-memberships-pro/adminpages/reports/login.php on line 403
[13-Oct-2017 09:39:58 UTC] PHP Fatal error: Uncaught Error: Cannot increment/decrement overloaded objects nor string offsets in /home/rciziapqb/public_html/wp-content/plugins/paid-memberships-pro/adminpages/reports/login.php:403
Stack trace:
#0 /home/rciziapqb/public_html/wp-includes/class-wp-hook.php(300): pmpro_report_login_wp_login(‘jonathan005’)
#1 /home/rciziapqb/public_html/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Array)
#2 /home/rciziapqb/public_html/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#3 /home/rciziapqb/public_html/wp-includes/user.php(104): do_action(‘wp_login’, ‘jonathan005’, Object(WP_User))
#4 /home/rciziapqb/public_html/wp-content/plugins/theme-my-login/includes/class-theme-my-login.php(482): wp_signon(Array, true)
#5 /home/rciziapqb/public_html/wp-includes/class-wp-hook.php(298): Theme_My_Login->template_redirect(”)
#6 /home/rciziapqb/public_html/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Array)
#7 /home/rciziapqb/public_html/wp-includes/plugin.php(453): WP_Hook->do_action( in /home/rciziapqb/public_html/wp-content/plugins/paid-memberships-pro/adminpages/reports/login.php on line 403

Did you know what can be the error ?

The code on this page didn’t work well for me. My friend Tom Harrigan helped me come up with something better that worked:

function my_gform_after_submission( $user_id, $feed, $entry ) {
if ( ! function_exists( ‘pmpro_changeMembershipLevel’ ) ) {
if ( 11 == $entry[‘form_id’] ) {
pmpro_changeMembershipLevel( 4, $user_id );
add_action( ‘gform_user_registered’, ‘my_gform_after_submission’, 10, 3 );

Where 11 is the form ID, and 4 is the membership level ID. Place code in functions.php or custom PMPro plugin.

Hi @toddcav and Jason,

I’m trying out:

function my_gform_after_submission( $user_id, $feed, $entry ) {
if ( ! function_exists( ‘pmpro_changeMembershipLevel’ ) ) {
if ( 9 == $entry[‘form_id’] ) {
pmpro_changeMembershipLevel( 2, $user_id );
add_action( ‘gform_user_registered’, ‘my_gform_after_submission’, 10, 3 );

but doesn’t appear to be working – do I need to change the (10,3) to anything else?

and how to modify the above so I can include two forms?
also need:
if ( 5 == $entry[‘form_id’] ) {
pmpro_changeMembershipLevel( 4, $user_id );

We’d be able to help you better in the member forums. With access to your site, we could tweak this for you. Let the forum thread know that I mentioned that.

The “10,3” there doesn’t need to change. It tells the hook to fire on default priority 10 and that the hooked function has 3 parameters.

The part that needs to change is the 9 == $entry… It assume 9 is the ID for your form. Also the 2 in pmpro_changeMembershipLevel means level 2.


Does codes doent seem to work for me!
I have a membership site where I have a FREE membership. I would like to have user register in my site with a gravity form (and register user add on) and activate the FREE membership when they create the account.

Can you help me out? The gravity form ID is 1 and the free membership level is 4

When adding this code it says – ” Not paying.” I created another level with same pricing to help sort between prospect and new clients. The pricing is exactly the same so I’d like to just have their level changed.

If you view the membership level on the edit user page, we added a little helper to show the pricing from the last PMPro checkout. If you manually change a user or use code like this, the pricing information isn’t known. So we say “not paying” although that might not be technically true.

Although when you call the pmpro_changeMembershipLevel function it will cancel associated PMPro subscriptions by default. You can disable this with this filter:

You can unhook that filter before and turn it back on after like this:

add_filter(‘pmpro_cancel_previous_subscriptions’, ‘__return_false’);
pmpro_changeMembershipLevel( 1, $user_id );
remove_filter(‘pmpro_cancel_previous_subscriptions’, ‘__return_false’);

Et voila! Pmpro and gravity form are both very fexible!
function update_pmpron_blog_id( $site_id, $user_id, $entry, $feed, $password ) {

update_user_meta( $user_id, ‘pmpron_blog_id’, $site_id );

add_action( ‘gform_site_created’, ‘update_pmpron_blog_id’, 10, 5 );

Jason any idea to link website id to pmro user (I use the gravity form “Multi-Site Creation on user-registration” function instead of pmpro-network and I need Pmro to know what website is used by the user )

function add_custom_user_meta( $user_id, $feed, $entry, $user_pass ) {

$level = pmpro_getLevel($level_id);
$custom_level = array(
‘user_id’ => $user_id,
‘membership_id’ => $level_id,
‘code_id’ => ”,
‘initial_payment’ => $level->initial_payment,
‘billing_amount’ => $level->billing_amount,
‘cycle_number’ => $level->cycle_number,
‘cycle_period’ => $level->cycle_period,
‘billing_limit’ => $level->billing_limit,
‘trial_amount’ => $level->trial_amount,
‘trial_limit’ => $level->trial_limit,
‘startdate’ => “‘” . current_time(‘mysql’) . “‘”,
‘enddate’ => date(“Y-m-d”, strtotime(“+” . $level->expiration_number . ” ” . $level->expiration_period)),

pmpro_changeMembershipLevel($custom_level, $user_id);

add_action( ‘gform_user_registered’, ‘add_custom_user_meta’, 10, 4 );

Ok.It’s work with
function add_custom_user_meta( $user_id, $feed, $entry, $user_pass ) {
//update_user_meta( $user_id, ‘user_confirmation_number’, rgar( $entry, ‘1’ ) );
pmpro_changeMembershipLevel( 2, $user_id);
add_action( ‘gform_user_registered’, ‘add_custom_user_meta’, 10, 4 );

now I will try to update expiration date and some other stuff ^^

Could you clarify what the code should be if the user isn’t logged in? In my case, I have a Gravity form where we are allowing one member to give a membership as a gift to another, so the logged-in user fills out the form and it creates another user via the User Registration add-on.

Here’s what I have – I have tried a few versions, including one where I was getting the user by email. The original tutorial for this post DOES work for giving a person a different membership level when the logged-in user submits the form, but this modification (based on spacebar’s comment above) does not. Could you help me figure out where I’m wrong?

function my_gform_create_member($entry, $form)
$user_id = get_user_by(’email’, $entry[5]);
pmpro_changeMembershipLevel( 1, $user_id );
add_action(“gform_after_submission_8”, “my_gform_create_member”, 10, 2);

This should work as long as $entry[5] has the user_id from the created user in it. Maybe that id is stored somewhere else? Maybe there is a hook in the User Registration addon you can hook into to change the user’s membership level after being created.

Thanks Jason (yes… I started to ask question to, but then found the answer) 🙂
Question though:
I got the code above to work with the Gravity Form Registration Add On, in that it registered the person, however, it did not assign the person the level ‘8,’ which is our free level. I placed the 8 in the right place in the code, as you indicated. However, it assigned them to no level. Is there something I am missing?

Probably because the code example above is using the user ID of the logged in user. In my case new registrants are not signed in, so I used get_user_by(‘login’, $entry[field# of username in my form]) instead. Works great.

Couple questions.
1. Do I place this in my custom pmpro plugin?
3. Am I correct that the ‘1’ in your example [pmpro_changeMembershipLevel( 1, $user_id );] refers to the pmpro level the user will changing to?
4. What do the “10” and “2” refer to in your example [“my_gform_after_submission”, 10, 2);]

Thanks for this. I just have a couple of problems. The level does change but it doesn’t set the expiry date that I assigned to this level. It comes up with ‘Never’ under the Members List.

Also, I have two different Gravity forms, both once submitted to assign the same level. Do you know how I can set both gravity forms (ID 2 and 3) to this script.

I’m pretty much a novice at this!

Thanks for your help.

Maybe sure that $level_id is pointing to a real level of yours and that that level has an expiration date. Or you could set the “enddate” value specifically. Otherwise, follow up in our member forums and we can help you some more.

Leave a Reply

For faster support related to issues on your specific site please open a ticket in our members support area.

Your email address will not be published. Required fields are marked *