Web development and useful information

person encoding in laptop

Allow Create and Update feeds with the Gravity Forms User Registration Add-On plugin

The Gravity Forms User Registration Add-On plugin allows you to Create (or Update) a WordPress user and their meta fields from a Gravity Form’s fields. It’s a great plugin.

By default, it only allows one feed type per form: a Create OR an Update feed.

I build a lot of Membership Application forms with Gravity Forms. I used to build two forms per User Registration feed: one for logged-out users and another for logged-in users. It was annoying for me and our clients to maintain two forms.

I spent some time seeing if I could use both a Create and Update feed on one form, triggering one or the other feed based on a user’s log-in state.
I found a way to do it. I’m sharing the code in case it’s useful to anyone.

To use this code, copy the class into a plugin (or your theme). Then call gravity_forms_user_registration::init() from an action such as ‘plugins_loaded’.

Previous

Beginner’s guide to record collecting

Next

WordPress Bookmarklets

2 Comments

  1. AJ

    Hi, thanks for sharing this. However I cannot get it to work… Please help.

    I have included a file named ‘gravity-forms-user-registration.php’ which contains your code, and have called it inside a hook using the example you gave:
    add_action( ‘plugins_loaded’, array( ‘gravity_forms_user_registration’, ‘init’ ) );

    The issue I’m having is on the backend of Gravity Forms, when I Edit my Form Settings and go to User Registration, where I can create a new Feed… the option to add a new Update Feed is disabled when I already have a Create Feed.

    How do I get around this? I tried simply removing the disabled=1 from the front-end HTML using Inspect Element, and that got me one step further, but I was thrown an error when I tried to Save.

    Thanks,
    AJ

    • AJ

      Hi, ignore the previous comment – I was missing a line from my functions file…

      Previously I had in functions.php:
      include ‘gravity-forms-user-registration.php’;
      add_action( ‘plugins_loaded’, array( ‘gravity_forms_user_registration’, ‘init’ ) );

      Now I have:
      include ‘gravity-forms-user-registration.php’;
      add_action( ‘plugins_loaded’, array( ‘gravity_forms_user_registration’, ‘init’ ) );
      gravity_forms_user_registration::init();

      So it seems I was just missing: gravity_forms_user_registration::init();

      However I have a new problem now…
      Now that I have successfully created an ‘Update’ Feed alongside my ‘Create’ Feed for the same form, when I test the form using a logged-in user, although the form submits and appears to work (and it even creates the Tx and Sub in Stripe) it does not however create a Tx or Sub within MemberPress.
      The result is that a subscription exists in Stripe but MemberPress does not register it.
      Any ideas what could be wrong?

      I have tested my setup using a separate form, which only has an Update Feed, not both… and this works fine. So I know that the rest of my setup is all functioning correctly it just appears not to work when the form has both an Update Feed together with a Create Feed.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Powered by WordPress & Theme by Anders Norén