Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 23, 2019 12:58 am

Protect Paid Content on Your WordPress Site Using a Free Membership Plugin

In this post, we’re going to explore the Simple Membership plugin which allows you to set up different kind of memberships for your WordPress site. With this plugin, you can create free and paid memberships and restrict content access based on rules for each type of member.

If you ever wanted to sell premium content on your WordPress website or to create rules to restrict access to certain kind of content based on user roles, this is the article for you! I'll show you how to create different membership levels for your website that you can use for content restriction, and just about anything else you can think of.

In fact, "free" and "paid" are just two broad categories that may themselves contain hierarchies of different membership levels, where each level may have a separate set of rules. 

As a site owner or being a seasoned WordPress developer, you already know that WordPress provides a lot of plugins for almost every feature one could think of, and it can be hard to choose which one to use. For this post, I’ve picked one of the best in the category—Simple Membership—and I'll show you how to use it throughout the course of this tutorial.

For this post, I’ve used WordPress 5.1, and Simple Membership plugin version 3.7. I  recommend that you install it if you want to follow along with this post. To install the Simple Membership plugin, you need to follow the standard installation process.

In the next couple of sections, we’ll explore the basics of the Simple Membership plugin along with the setup process. Then, we’ll build a real-world example which will demonstrate use of this plugin. Meanwhile, we’ll also go through a few important aspects of this plugin that allows you to create different levels of memberships.

What Is the Simple Membership Plugin?

The Simple Membership plugin is a flexible and easy-to-use plugin which can be used to create different membership levels that can offer free and premium content. Thus, you could restrict premium content of your website to paid members. It allows you set up unlimited membership levels according to your requirements.

Let’s have a quick look at the features it provides:


  • free and paid memberships

  • unlimited membership access levels

  • API support for developers

  • built-in member login widget

  • compatible with any WordPress theme

  • and more

As you can see, it provides a lot of useful features that you could use to build a flexible system offering different kind of memberships. And it’s also extendable, which is an important feature, since it provides developers an opportunity to alter certain aspects and even the core behavior of the plugin.

In the next section, we’ll discuss a couple of core elements of this plugin that are important to understand if you want to use this plugin effectively.

Explore Plugin Settings

Once you install the Simple Membership plugin, it will add a link in the left sidebar. Let’s go through the each section briefly.

Members

This is a member listing page which lists all the members registered by using this plugin so far. You can also create new members.

Apart from that, it also allows you to perform a few bulk operations. For example, you could bulk update the membership level of users who belong to the silver level to the gold level.

Membership Levels

This is a membership levels listing page which lists all the membership levels you’ve created so far in your website. You can add as many levels you want to add in this section. Apart from that, you can bulk protect existing categories, posts and pages in this section. We’ll get back to this later in detail.

Settings

In this section, you can configure settings that are globally applicable. You can configure different aspects of this plugin like:


  • general settings

  • payment settings

  • email settings

  • tools settings

  • advanced settings

Configuring proper settings in this section is critical to the workings of this plugin. I’ll go through a couple of important and must-have settings later in the post to demonstrate how to use this plugin to create and use free and paid memberships.

Payments

This section shows all the payments received so far by using this plugin.

It’s also one of the important sections of this plugin because it allows you to create payment buttons that will be used to collect payments for paid memberships. As of now, it supports creating PayPal, Stripe and Braintree payment buttons. We’ll get back to this section when we’ll create the PayPal button for the paid membership.

So that was a brief introduction about the features provided by this plugin. In the next section, we'll build a real-world example as a demo.

Build a Real-World Example

In this section, we’ll build a real-world example to demonstrate how to use the Simple Membership plugin to create free and paid memberships on your WordPress site.

Before we proceed, make sure that you’ve installed the Simple Membership plugin in your WordPress site if you want to follow along.

Create Free and Paid Memberships

Firstly, we need to create free and paid membership levels from the back-end. So, let’s go ahead and set it up.

Go ahead and access the WP Membership > Membership Levels link in the left sidebar on the back-end. That should list all the existing membership levels in your system. Click on the Add Level button to create a new membership level, and that should open the following UI.

Add Free Membership Level

Fill in the necessary details as shown in the above screenshot. As we’re creating a Free Membership, we’ve selected the No Expiry option in the Access Duration field. In the role drop-down box, we’ve selected the subscriber role. With these settings, you can hit the Add New Membership Level button.

In the same way, let’s add the Premium Membership.

Add Premium Membership Level

As you can see that, everything is same except the Access Duration setting, and we’ve set it to 1 Year so that the membership expires after a year.

Configure Settings

As we’re going to offer the free membership level on our site, we’ve got to enable it in the General Settings section. In the previous section, we’ve already created the free membership, so now we just need to configure it.

Go ahead and access the WP Membership > Settings > General Settings section. Make sure that the Enable Free Membership checkbox is checked and you’ve configured the correct Free Membership Level ID as shown in the following screenshot.

Enable Free Membership

Create Premium Membership Button

As we’re offering the premium membership level in our example, we’ll have to create a payment button so that users can use that button to pay the membership fee. In our case, we’ll create the PayPal membership button.

Go ahead and access the WP Membership > Payments > Create New Button section, it will ask you to choose one of the following options.

Create New Button

Select the PayPal Buy Now button and click on the Next button.

Button Configuration

Fill in the necessary details as shown in the above screenshot. In the Membership Level drop-down, select the membership level for which you want to create this button for. It’ll be Premium Membership in our case.

Also, make sure to enter a valid Return URL where the user will be redirected after a successful payment. Finally, click on the Save Payment Data to save settings, and that should redirect you to the Manage Payments Button UI as shown in the following screenshot.

Short Code

Note down the Button Shortcode as we’ll need it to display the payment button on the Join Us page now.

Include the Payment Button in the Join Us Page

The Simple Membership plugin already creates a few necessary pages so that membership features work smoothly. By default, it creates Registration, Member Login, Profile and Join Us pages.

Among these pages, the Join Us page is something which we would like to change. This is the page which will be displayed when user clicks on the Join Now button. You can design this page any way you want, but for now we’ll just include the payment button that we’ve already created for the premium membership.

Go ahead and access the Pages section and edit the Join Us page. Replace the payment button placeholder text with the the button shortcode which we created in the previous section.

Edit Join Us Page

Make the necessary changes as shown in the above screenshot and save it!

So far, we’ve done the necessary changes to set up free and premium memberships on our WordPress site. In the next section, we’ll see how it works in the front-end.

Front-End Testing the Membership Plugin

For testing purposes, we’ll create posts that can be only accessed by members, either they belong to free or paid membership levels.

Go ahead and create a new post in the back-end. In the edit UI, you should be able to see the section titled Simple WP Membership Protection. In that section, select Yes to protect this content. Also, select the membership level that can access this content. For this post, we’ll select the Free Membership.

Assign Free Membership to Post

Repeat the same process to create an another post with the only difference is the membership level, select the Premium Membership for that post.

Now, let’s access these posts in the front-end to see how they look.

Front-End View

As you can see, the content is not visible, and there’s a message which asks you to either login or join the membership! Click on the Join Us button to get to the Join Us page.

Buy Now Button

If you want to access the content which is available under the Free Membership, you just need to register and login, and that should do it. On the other hand, if you want to access the premium content, you need to pay the premium membership fee by clicking on the PayPal button which was created for the Premium Membership.

So that’s how it works altogether. You can create as many membership levels as you want with this plugin. Explore the other settings and have some fun with it!

Conclusion

Today, we discussed how to set up membership features by using the Simple Membership plugin in WordPress. We went through an in-depth overview of this plugin and implemented a real-world scenario for the demonstration purposes.

Feel free to share your thoughts and feedback using the feed below! I would love to hear from you if you want to share your experiences about other membership plugins that you have used on your website.

And while you're here, check out some of our other articles about WordPress membership plugins!



Original Link: https://code.tutsplus.com/tutorials/protect-paid-content-on-your-wordpress-site-using-a-free-membership-plugin--cms-33120

Share this article:    Share on Facebook
View Full Article

TutsPlus - Code

Tuts+ is a site aimed at web developers and designers offering tutorials and articles on technologies, skills and techniques to improve how you design and build websites.

More About this Source Visit TutsPlus - Code