Introduction

WordPress already has quite a lot of the functionality you need to create a basic membership site. The trouble is, you quickly realise that some parts of the functionality can be improved. The nice thing about WordPress though is that you can nearly always find a plugin that will help you as your site grows.

In this tutorial, we’ll be using Gravity Forms and Justin Tadlock’s Members plugin to turn WordPress into a basic membership site and require visitors to register to be able to see protect posts and pages. Non-members will only see the titles of the posts.

Once you’ve got the plugins installed, the configuration only takes a few simple steps.

Step 1: Setting up the registration form

WordPress, out of the box, is limited to a rather sparse registration form with just username and password fields in the middle of a virtually blank page. It’s all very zen but not much use if we need to collect more information about the users, sign them up to a mailing list or require that they accept terms and conditions. By using Gravity Forms to create the registration form we get the features you might expect for a membership site; we can put the registration form on any page or widget area, include any additional fields, make sure that users get signed up to an email list, require email verification and keep the account on hold until the administrator’s approval.

To create our basic registration form we need to create a new Gravity Form following the directions here. You’ll end up with a form that looks something like this:

The user won’t be logged in automatically so you may want to change the form’s confirmation message to display a link to the login page.

Now we’ve got the form set up we need to tell Gravity Forms that this form will be used for new user registrations.

Step 2: Configure the form to create user accounts

Once you’ve installed the User Registration Add-On you’ll need to set up a simple user registration feed. This will map each field on the registration form to a field in the WordPress user settings and will make sure that Gravity Forms creates the user account with the right information.

Don’t worry about the User Meta and Additional Options sections for the moment – you can add those options later if you like.

The registration form now knows it has to check the username field to make sure it’s not already taken. If there’s another account with that username then form will fail the validation and ask the user to choose a different username.

Now we have a Gravity Form configured to create user accounts for our members we need to protect some content.

Step 3: Protecting content

WordPress has a couple of options for protecting content but neither are particularly helpful for a membership site. The first requires the post author to assign a password to each post and the second requires the user to be an editor of the blog. We’ll need to make sure that all registered users can see our protected content so we’ll need finer control over who can see what.

There are lots of plugins that will do this for you to varying levels of complexity but our basic membership site just needs a simple plugin that will allow us to hide certain content from non-members. Justin Tadlock’s Members plugin has been around for a long time and continues to be developed and supported and it gives us plenty of control.

Once you’ve installed and activated the Members plugin you’ll find this box on the edit page below the content of each post and page:

The only thing we need to configure here is the role which will have access. Select the “subscriber” role for each of the posts and pages you’d like to protect. This will ensure that all registered users will have access to content and anonymous users will see something like this for protected posts and pages:

Step 4: Add a login form

The standard login form on WordPress is like the registration form. It works perfectly but it doesn’t give us any control over what the login page looks like. If we want to integrate the login form into one or all of the pages we’ll need to use a plugin. The Members plugin, in addition to controlling access, also has a login widget that you can activate in the settings and then add to a sidebar. By default it will look like this:

And once the user has logged it, it’ll look like this:

For further control over the login form, and the logged in content, try the Sidebar Login plugin.

That’s all there is to it – your WordPress site is now set up to provide protected content for members only.

Next Steps

As your membership site grows you’ll find you want to refine the set up further.

Remove the admin bar

One of the first things you’ll probably want to do is hide the admin bar that appears at the top for logged in users. Again, lots of plugins will do this for you for instance Admin Bar Disabler and Admin bar.

Auto-login after register

If you’d like to save your newly registered members the additional step of having to log in immediately after registering there’s a little snippet of code here that you can add to your theme’s functions.php file that do this for you. New members will be automatically logged in so you can send them directly to your member content.

The new Gravity Perks add-on provides this functionality as a perk: GP Auto Login. No need to get messy editing your functions.php. Just click, install, and activate.

Charge for access

You can easily add a paywall to your membership site by using the Gravity Forms PayPal Add-On to require payment before the account is created. Both one-off payments and recurring subscriptions with automatic account cancellations are supported.

Add more membership levels

The Members looks very simple on the surface but it’s actually a very flexible and deceptively powerful plugin. With a bit of planning and care it can be used to create multiple membership levels which you can then assign to users, post and pages.

Protect downloads

If you have a special download like a pdf report or a product that only your members should have access to then that link needs to be protected to reduce the risk of unauthorised sharing. The PluginBuddy S3 URLs plugin will generate a link to your download that expires automatically after a specified number of seconds.

Configure admin approval for new accounts

By activating the “user activation” option in the current version of the Gravity Forms User Registration Add-On (1.5 beta1.2) the user will receive a mail with an activation link which will create the account immediately. If you’d like to make sure that only the administrator can approve the account you’ll need to add the following bit of code to the functions.php file in the current theme.

Comments

Hi, thank you for this tutorial. I still have 2 questions…
Does the Gravity Form user registration add-on also provides a ‘profile’ page when users are logged in? Where they can view their personal information (adress, phone,…)

And can I create a unique member code with every member that registers?
The company wants this code to be build op like this:
* M or F (gender)
* year of registration
* Radom 5 digits

Hi Ann, no GFUR does not provide a default profile view. You could use the Gravity Forms Post Content Merge Tags plugin to output the desired user info on a page if you desired (e.g. {user:first_name}, {user:last_name}).

Still one question :-)
If I use Gravity Forms Post Content Merge Tags to create the ‘profile’ page. Can they also change any information that is shown there? For example is someone has a new phone number can they change it to the new number?

I have a couple of queries though. Once you’ve used a plugin to hide the admin bar, how does a user logout? When they’re in, there’s no ability for them to log out?

Also, if a user enters the wrong username and/or password on the login page, they’re taken to the normal WordPress login page to try again. I don’t really want users seeing anything to do with WordPress. How can I resolve this please?

Hi Matt, you can provide a number of ways to logout such as a link in your WordPress menu or footer or a widget in the sidebar. There are number of other options for the default WordPress login widget. Try the User Registration’s login widget: https://docs.gravityforms.com/user-registration-widget/

As far as user subscription management, what do you recommend. I love the user backend you use for Gravity Wiz for customers to manage their subscriptions, license and account info. What do you use for this interface!

Great article, I used this same practices and plug-ins without reading it, so I obviously agree :)

But there’s one missing piece to my puzzle: how do you automatically change user level after paid subscription? I actually have free members (all of them imported via csv from a non-WP site and turned to a role of Free Members) and I would like them to seamlessly change to VIP Members after payment.

Question: I have a lot of users who have already made a donation on a site via GF that I would like to convert to members. Is it possible to do that with a GF add-on? Otherwise, I would have to download all the GF data and then upload them again with a plugin.

I am looking for a particular function and I would like to know if it is possible to accomplish that before buying GF.

I would like my logged in users to be able to sign up for an activity, like a football tournament. I would like them to click on a button “Join” and then the admin would automatically receive an email with the user info saying that he wants to register for this activity?

Currently, I am not able to combine my current membership plugin and Contact Form 7. Therefore, my logged in members have to fill their username and email address again to join an activity, I’d like to avoid that.

Hi, came to this email from Chris Lema! Brilliantly explained, I can almost understand all of it, which is great! I already have a WordPress website with woocommerce. I am learning everything as I go along, no tech experience.

I have developed a new product – I am hosting all the audio with Soundcloud and embedding it into a page on my website. I also have downloadable pdf forms to go with the product. When customers purchase the product I want them to have to login each time to access the content which is laid out on a WordPress page, where the content is protected and available only to those, who have bought the product/set up their log in details.

Following your advice in this blog, will that create what I am looking for?

Great tutorial! Any advice on having the WP Dashboard show up, when a user logins? Right now, a website I’m working on show the WP Admin bar and the website. I want the user to see the WP Dashboard, where they can see their posts. Please advise.

Thanks for the suggestion of using Peters redirect. It works well, when a user logs into my site via the /wp-login page. I have a login form on my site though. The redirect doesn’t take the user to their dedicated page (I have role-based permissions set on certain pages). It does redirect when going the wp-login route, but not from my login form. The login form still shows the entire Website, with the toolbar. Any ideas? Does that make sense?

Thanks for posting this. This got me most of the way there. The problem I’m struggling with now is how to let the user update their profile info. I used sidebar login as suggested.
– That profile link goes to the wordpress back end. Can I use the front end and also show the fields from the original registration?
– I am confused about “create” and “update” action. I tried to duplicate the form and have one be “create” and the other “update” but I don’t think that works. Now I have two forms and split entries.
Would you be able to add to this tutorial. What I’m trying to do is actually very similar to what you do on this site. Add a Login link in the top menu. Once logged in, user can see their profile info and update it.

Hi David, you have the right idea. One form creates the user. The other form updates the user. Each has their own corresponding feed with the appropriate action (via the User Registration add-on). Let me know if there is a specific issue you’re having with this configuration.

Thanks. I ended up hiring someone to help but am starting to get how this works. I was mainly confused initially trying to get this to work with a single form. Having two forms and two feeds makes sense and is what we ended up doing to make it work.
Initially, I was going to use gravityforms to view entries and thought GF could update entries. But now I see there will be duplicate entries so we will view data from the Users section instead of forms.

Hey guys, great info! One question, my client has people already with an account. He simply wants to have them be able to login at then on the front end gravity form fill out options that can be pushed to their WordPress profile. Can I do this without making people register as a new client?

Hi Tom, I believe you can create new subscriptions but I don’t believe the Stripe plugin supports canceling an existing subscription. If you’re doing this setup with Gravity Forms, I don’t see any way to avoid needing to write some custom code. I’m not familiar with Paid Memberships Pro but if it does what you need, I’d say go for it. :)

I have already your article and comment.Wow, I got the lot of thinks from there. This article and every comment is very helpful.However, I want to add something, and recently I just released the membership plugin in the wordpress repository who is called “rs-members”. Before developing I just studied existence all membership wordpress plugin.I got many problems from the those.As a result; I just tried to include many useful features.Without programming skill any guys can easily maintain this plugin. I hoped this plugin will be helpful fill up your all demand. .Guys you can visit my “rs-members” from wordpress repository.

Most membership plugins have reports… Any suggestions for having daily, weekly, monthly, yearly, etc reports on new and current members? I’m trying to figure out a way to keep what I have with GF and track overall sales. I was thinking of using their freshbooks add-on but that would make every sale an invoice, which would have to be manually “ended” to count as a sale. Not sure if this would also work since membership is a subscription so the next payment received may not reach freshbooks? Perhaps you know of another plugin or way to track sales and orders made via GF?

Thanks for all the info! I am using GravityForms for my site and never knew about the user/update functionality of their registration add-on. A question that I have for you… When charging $x/month, how does a member cancel their subscription? Is there also a hook or some code that places their account into “not active” ? or do we have to manually edit something to cancel their subscription? thanks!

I’m using the “admin approval” feature you provided code for above, for new users to be “approved” before given access. The user activations appear to work fine, except that the Password a user enters in the form appears not to be linked up with their account.

I’ve tested this a few times. Still the user-selected password does not work on the Account Login.

We are limiting access to the pricing in a WooCommerce store to only logged in users. This all works fine. I’m just telling you what our site is doing. Additionally, we are using Membership Pro for controlling what shows up in the menus.

This is a fantastic post, answering many questions! Can this user approval ‘system’ be utilised with paypal payments? I’m assuming it can be, but does the approval trigger the payment or does the payment happen first regardless of the approval being given (which would mean that a refund be given if the approval is not given)?
Thanks!

Hi Felicity, sorry, I misread your question. The payment is required for submission, not approval. So the payment is collected regardless of approval. Not aware of any way to delay the collection of the payment.

This is insanely helpful, thank you! One question: Up until now, I have been using the CIMY User Extra Fields plugin to capture additional fields of information from my users. I want to switch to Gravity Forms so I can simultaneously port the info over to Batchbook and Mailchimp when a user registers. But what do I do with the info from all of my existing users to make sure it’s all stored in the same place?

I can export the existing user data to a csv file and rename the columns. But it doesn’t look like there’s a way to mass import into Gravity Forms. (The Gravity Forms Mass Import plugin doesn’t work for the latest version of Gravity Forms.)

Hi Seth, with the GF User Registration add-on, you can map any form data to the user. When data is stored with the user, it is called the user meta. I’m not familiar with CIMY User Extra Fields; however, most plugins store user-specific data in the user meta so there is a good chance the data is already in the same place. If not, you’ll likely need to write or commission a custom importer.

That’s what I would have thought, but the CIMY fields don’t appear to be showing up in the dropdown menu. I think I may simply require users to update their profile.

One thing I have noticed: You can use a form that CREATES users multiple times for user registration, allowing you to use conditionals to assign a user to a different role depending on their answer to a question. However, you do not seem to be able to use the same form multiple times to UPDATE users, so I cannot create a way for users to change their own role. Any thoughts on a workaround?