How To Use Gravity Forms To Create Free Memberships With Membermouse

Last Updated on April 29, 2020  

There are definite use cases for offering a free member level on your membership site. And like most membership site plug-ins, MemberMouse is perfectly capable of taking on free members.

(Not super familiar with MemberMouse? Check out my review.)

That said, the actual process of creating a nice looking form for free member signups is a bit clunky with Membermouse. If you're good at coding, you can make it work. Essentially, this is the normal way...

  1. Go to MemberMouse > WebForms.
  2. Choose the free member level you want to stick people into.
  3. Check off the custom fields you want to be included on the form.
  4. Generate the HTML.
  5. Copy that code into a page of your choosing and then hand-code it accordingly.

Now, this works. But, it does leave a lot to you in terms of coding it to look good. Also, MemberMouse only offers 5 types of custom fields. In most cases, that might be adequate.

But, what if you want to use the familiarity or flexibility of Gravity Forms to create a member signup page?

It is definitely possible. And I'll show you how to make it happen. There is some coding involved, but I'm sure you expected that. 🙂 And I'll give you a big head start.

Why Use Gravity Forms Over The Standard Form?

Here are a few of the reasons I decided to use Gravity Forms for the account signup process to the new, free limited LAB membership:

  • I can use a multi-step form pretty easily without having to code it by hand.
  • I can use conditional logic (i.e. only show certain fields based on the value of other fields)
  • I can collect more information and have it available for easy reference in the Entries list for Gravity Forms.
  • More control over form validation without having to do it manually

In essence, Gravity Forms is just one of the best form systems available for WordPress and it will obviously blow the snot off of MemberMouse since that's not the core functionality of MemberMouse.

There are several convenient features I can do with point-and-click ease with Gravity Forms that I would have to create manually using the HTML that MemberMouse gave me.

The True Power Of A Free Member Level

Before we dive into the geeky part, let's first talk about the form itself. If you're going to bother offering a free member level, you want to make it worth it.

The way I see it, collecting useful segmentation information as part of the account creation process makes all kinds of sense. If all you do is ask for name and email, you're wasting the opportunity.

In my case, I ask for several things, such as:

  • Whether they have a blog or not
  • If they do, what niche is it in? And what's the URL?
  • How much traffic they get
  • Size of their email list
  • Their biggest challenges
  • The kinds of training they would most value

Do you see how this kind of stuff would make my marketing way more effective?

For instance, if they don't have a blog yet, that's a good opportunity to talk to them about the initial aspects of site setup (like choosing hosting, etc.)

I should probably talk to a newbie way differently than a more advanced blogger.

Point is...

Create a member signup form that asks for useful information that will allow you to send them much more targeted recommendations and followup marketing.

And get this...

  • We can sync this data to our CRM (in my case, Drip) and send them the appropriate followup marketing
  • We can sync the applicable data to MemberMouse and even customize their member experience based on what we know about them.

This is not a marketing post, but I sure hope you see how powerful that can be when fully utilized.

Oh, hell yeah! 🙂

OK, moving on...

We're about to get into the nerdy stuff. What follows in this post is definitely intended for people with development experience. You've been forewarned. 😉

Create Your Free Signup Form With Gravity Forms

First things first... go ahead and create your signup form with Gravity Forms. I won't waste my time showing you how to do that since if you're reading this, you likely are already somewhat familiar with Gravity Forms.

Don't get overzealous with the data you ask for. Don't make it too overwhelming. But, think about the data that would be most useful in terms of the best member experience and followup marketing.

Don't forget that you can use multi-step forms and conditional logic with Gravity Forms to make a form that is easy to use.

A few things to keep in mind:

  • Don't forget to ask for their name and email address. This information will be later fed directly into MemberMouse to create their member profile.
  • For radio buttons, you might want to use the Value field on options. Unless you specify one, any selected option will save the full text of the option to the database. But, remember you need to be able to select this stuff in marketing automation rules or in MemberMouse. Case in point, one of my options for how they describe themselves is "I own/run an offline business and am interested in extending our marketing online or implementing blogging to grow my business". That's a hell of a text string to work with. So, I just set the value to "Offline_Biz". Much easier to reference later.
  • You can use free form entry fields when appropriate, but keep in mind you won't be able to use them in any followup logic. For instance, I ask people about their blogging niche. If I allowed a free-form entry for that, they could type anything. Instead, I use a dropdown so that I can control the values and therefore actually USE the data later in my CRM or inside the membership.

OK, got yourself a Gravity Form set up for your free membership?

Rock and roll. Now, let's get nerdy...

First, Sync The Entry To Your CRM

One of the great things about Gravity Forms is that it has a number of add-ons already pre-programmed for syncing data to your CRM. This way you can put free members onto your email list along with all of the targeting information you just collected.

Some of the available add-ons include:

Keep in mind, Google is your friend. Chances are, whatever CRM you use, there's an add-on to hook it up Gravity Forms. There's also Zapier if you need to go that route.

Since I use Drip, I used the Drip add-on. It does a great job of allowing me to sync fields from my Gravity Form into custom fields in Drip. I can also add tags as I want. I can even do it conditionally, assigning certain tags depending on their input on certain fields. It's pretty awesome, really.

Now, as you likely know, you could also use MemberMouse to sync with your CRM once you have created the member profile. After all, MemberMouse has the powerful Push Notifications feature that would allow you to push notifications into 3rd party services as the member is added.

I didn't go that route because I didn't necessarily want to sync everything to MemberMouse. Plus, Gravity Forms just has more support for CRMs than MemberMouse. Drip happens to have a pretty good integration with MemberMouse, but whatever... I still did it directly. 🙂

Which brings us to the crux of the matter...

Syncing Your Gravity Form Entry With MemberMouse And Creating The Membership

The final step is to actually create their free membership and then send them off to the confirmation page as defined by Membermouse.

To do this, we will be making use of the Membermouse API. The API allows us to perform various membership operations from outside applications. 

We're about to get really nerdy here. The  information presented here is for somebody who is comfortable with PHP code and general web development. If you want to make this work and don't have the skills to do it, hey.... you're normal. 😉 People like me... not so much. 😉 So, you can actually click here to learn how you can have me simply implement this FOR YOU right on your site.

We are going to create a custom PHP script which will make use of the MemberMouse API. It will accept certain variables passed to it in the URL and then use that info to create their member profile. It will also sync certain selected fields from your form to custom fields inside MemberMouse so that we can use the information inside our member portal.

If you're an experienced coder, you may also realize that this could be done another way. Instead of passing variables to a script, you could just use the Gravity Forms hooks to catch the form submission and do this stuff behind the scenes. Your call. Different strokes. 😉

First, create a PHP script. You can drop it into your filesystem anywhere you want, really. For the sake of our discussion here, let's assume you name the file createaccount.php. Here is the basic code to use as a starting point...

require_once( '[ENTER FULL PATH TO YOUR WP-LOAD.PHP FILE]]' );
//error_reporting(E_ERROR | E_PARSE);

$apiurl = "[APIURL]";
$apikey = "[APIKEY]]";
$apipassword = "[APIPASSWORD]]";

if ($_REQUEST[email]=="") {
	echo "Error";
	exit;
}

$first_name = $_REQUEST[first_name];
$last_name = $_REQUEST[last_name];
$email = $_REQUEST[email];
$website = $_REQUEST[website];
$niche = $_REQUEST[niche];
$concern = $_REQUEST[concern];

$inputParams = "apikey=".$apikey."&apisecret=".$apipassword."&";
$inputParams .= "email=".$email."&"; 

$apiCallUrl = $apiurl."?q=/getMember";
$ch = curl_init($apiCallUrl); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $inputParams); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
$result = curl_exec($ch); 
curl_close($ch);
$data = json_decode($result);

// There is no member profile with this email address
if ($data->response_code==409) {
	//echo "member doesn't exist yet
"; $inputParams .= "membership_level_id=1&"; $inputParams .= "first_name=".$first_name."&"; $inputParams .= "last_name=".$last_name."&"; $inputParams .= "membership_level_id=1&"; $inputParams .= "custom_field_2=".$website."&"; $inputParams .= "custom_field_19=".$niche."&"; $inputParams .= "custom_field_20=".$concern."&"; $apiCallUrl = $apiurl."?q=/createMember"; $ch = curl_init($apiCallUrl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $inputParams); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $createresult = curl_exec($ch); curl_close($ch); $createdata = json_decode($createresult); if ($createdata->response_code==200) { $confirmationurl = $createdata->response_data->confirmationUrl; wp_redirect($confirmationurl); exit; } } else { // There is an existing profile. Let's update a few of the custom fields $inputParams .= "custom_field_2=".$website."&"; $inputParams .= "custom_field_19=".$niche."&"; $inputParams .= "custom_field_20=".$concern."&"; $apiCallUrl = $apiurl."?q=/updateMember"; $ch = curl_init($apiCallUrl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $inputParams); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); curl_close($ch); wp_redirect("[SOME PAGE THAT TELLS THEM THERE IS AN ACCOUNT WHICH EXISTS ALREADY]"); exit; }

Now, there's some things you will need to replace here in that code:

  • At the top, enter the full system path to your wp-load.php file. This file is in the root folder of your WordPress install. You need to include that file so that you can run WP-specific functions and have them work.
  • You also need to enter the API URL, username and password to MemberMouse. This info can be had by going to MemberMouse -> Developer Tools -> API Credentials. 

Now, we need to talk about how those custom fields work with MemberMouse. In this code, you can see that I am sending over 3 custom fields by ID. When you create a custom field in MemberMouse, you can call it whatever you want. In the API and in SmartTags, however, you refer to the custom field with it's ID number. To get the ID, just go to your list of custom fields and hover over the field name. It will show you the ID number in a little popup.

In that image, you can see that "Main Concern" is actually custom field #20. So, in our custom PHP script, we will refer to that field as "custom_field_20". Make sense? Cool. 🙂

So, in this PHP code, I am choosing to only sync 3 of the Gravity Forms fields into MemberMouse:

  • Their website URL (which is custom field #2 in MemberMouse)
  • Their niche (which is custom field #19 in MemberMouse)
  • Their biggest concern (which is custom field #20 in MemberMouse)

You can obviously create any custom fields you want in MemberMouse and sync any of the inputs from your Gravity Form into it. Keep in mind, however, that you only need to sync the fields you actually will want to reference inside your member portal. If all you want to do is collect and read the info, you don't need to sync it to a custom field since we have other ways to go about that.

OK, let's walk through what this script is actually doing...

First, if the member's email address is not being fed into this script, we simply abort. Email is required in order to create a member profile with the MemberMouse API.

Next, we use the GetMember API call for Membermouse to see if there is an existing profile for this user already. This is actually important because if we don't do this, the API will simply overwrite their existing profile otherwise. If we had a paying member decide to fill out this registration form, they would suddenly turn into a free member and have their subscription cancelled otherwise. So, we want to check to see if there is a profile already and act differently if it exists.

If we get a response code of 409 from the API, we know there is no existing profile with that email address. So, we go ahead and create one. We set them to a member level for our free level (ID #1 in my setup), send over their name and some custom field data. If it is successful (response code 200), then we get the confirmation URL which is fed back to us via the API and we send them there. You use that page to confirm their registration, etc. You can even present an upsell into your paid member level (hint hint!).

Now, if we don't get a response code of 409, then we know there was an existing profile already in the system for that email address. So, we simply sync up the custom field data in order to enrich their profile a bit with more information.... then we redirect them to a page which simply tells them there was an existing account and they can login, yada yada. 

Make sense?

Now, there's just one more geek thing to do here to make this work...

We need to make it so that submitting our Gravity Form calls up this custom script we made for ourselves. Actually, you already did the hard work. This part is easy.

For your Gravity Form, go to the Confirmation settings and choose a Redirect URL. We're going to set up the following settings...

For our Redirect URL, enter the full URL path to the custom PHP script (createaccount.php). Then, tick the box to pass field data via Query String.

You can now use the little selector dropdown to help you pre-populate the query string to include the fields you want to pass to your script. Whatever you call these variables in your URL is exactly how you will need to reference them in your PHP code. Basically, you are passing GET variables as URL parameters to your custom script right from your Gravity Form.

Now, as I mentioned above, you may also realize that you could accomplish this same thing via another method: using WordPress hooks triggered by the Gravity Form submission. 

You could create a custom function in your theme's functions.php file which uses the gform_after_submission hook to run some custom code when your Gravity Form is submitted.

Yep, that would work, too. 🙂 Totally your call. It would be the same basic idea, though. You would still be using CURL to submit data into MemberMouse using the API.

So, Here's What Happens Now...

So, with this setup fully in place, here's what's going to happen when a person fills out your free registration form that you built with Gravity Forms....

  1. An entry will be created in Gravity which you can view just as you normally would.
  2. The information that you select will be synced with your CRM, thereby allowing you to send more targeted emails to your new member.
  3. The information you select will be fed right into MemberMouse so that you can customize their member experience using custom fields and the Member Data SmartTag for MemberMouse.
  4. They will be automatically routed to the confirmation page you specified.

It's a beautiful thing.

You will have useful segmentation information in your CRM. And you can customize all kinds of things in your membership site with that custom field data.


TOPICS


Related Articles You Might Like:

Why And How I Switched My Optins From Thrive Leads To ConvertBox

  • David Keil says:

    Hey David,
    Thank you for posting this.
    Unfortunately, I can’t get it to work as it is.
    For one there is no: turned into & and > I assume when you copied and pasted etc…
    Also, line 39 is the same as line 36. Was 39 supposed to be email maybe?
    When I run this script, replacing amps and gt’s It passes through to my drip account but does not create a member, nor redirect to the confirmation page associated with the membership level.
    I appreciate that you put this out for free. I’ve been a lab member for years and have learned so much from you. I appreciate any response or corrections you can make. I’d much prefer to use GF instead of embedding the MM form.
    Thanks Again,
    David

    Reply

    • David Risley says:

      Yes, it does seem as if the script is rewriting the > characters, so those would need to be fixed by hand.
      Also, yes, it seems as if line 39 can be removed as it is redundant.

      To run the code, you can call it up manually in-browser and just pass some variables into it by URL. This way, if the script is producing a parsing error or something like that, you can see what is causing it.

      Reply

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
    >
    0 Shares
    Share
    Tweet
    Share