Basic WordPress Membership Site with Protected Content using Gravity Forms – Gravity Wiz

Level of difficulty: easy, really easy

What you’ll need:

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 WordPress 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.

Benefits of a membership plugin

Using a dedicated membership plugin on your WordPress website can help you keep things organized and deliver a good user experience to customers. You can use it to:

The only problem is that a dedicated membership plugin has lots of features that you won’t need if you’re looking to build a simple Gravity Forms membership site.

So, while you could certainly use a dedicated membership plugin, there’s a simpler way when you need a simpler website. Gravity Forms and Members do all these things well.

How to set up a basic WordPress membership site using Gravity Forms

To set up a basic Gravity Forms membership site, you’ll need to first install the Gravity Forms plugin and Justin Tadlock’s Members plugin. Once you’ve installed and activated both plugins, you can add new members to your site or to your CRM on form submission. One way to do this is by using an API like Zapier.

This way, whenever someone submits a form on your website, they’ll automatically be added to your Gravity Forms membership site and CRM.

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. This helps you deliver a good user experience.

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:

If you want to hide posts completely then you may want to try the WordPress Access Control plugin.

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 or a WooCommerce checkout using Stripe. 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.

Steve Henty is a developer at rocketgenius.

Did this resource help you do something awesome with Gravity Forms? Then you’ll absolutely love Gravity Perks;
a suite of 32+ essential add-ons for Gravity Forms with support you can count on.

This content was originally published here.

Sign Up for Updates and Special Offers

Jeff Kerby

CEO | KERBCO Web Services