Build a Wordpress Membership site - YourMembers/yourmembers GitHub Wiki

I often get told that building a Membership is hard and while coming up with great content and the perfect landing page is hard to do the actual mechanics of a membership site do not have to be. Your Members is a WordPress plugin that takes the pain away from running a membership site allowing you to be up and taking payments in no time. This tutorial will guide you through setting up your first membership site using WordPress.

 

What do you need to get started?

  • An existing blog/site running WordPress from wordpress.org that can install plugins.
  • Interesting content (sorry we can’t help there)
  • A copy of Your Members
  • A cup of tea or beverage of your choice to enjoy during the uploading and backup stage.
  • About 25-30 minutes to spare (including reading time)
This tutorial assumes you are familiar with WordPress admin area. You do not need to write any code to use Your Members but you should be use to adding posts and pages, and configuring the settings area of your site.

What will the outcome be: By the end of this tutorial you will be able to turn your existing WordPress site into a membership site which users can sign up to a recurring payment, change their profile information, update their payment options if they expire and most importantly protect content so only paying subscribers can see some of the content.

 

Getting started

Before getting started, take a backup of your site. This is good practice whenever installing any new plugin on your site.

For this tutorial just upload the Core Your Members plugin by unzipping it and using your favourite FTP client to upload the ym folder to your websites plugin directory. This is normally /wp-content/plugins so you should end up with /wp-content/plugins/ym/ and inside the YM folder should be several files and directories.

Before we activate Your Members we should make sure WordPress is able to let users register. To do this, in your WordPress admin select Settings and in General Settings, tick “Any one can register” by Membership and save the page. Once you have uploaded, visit your WordPress admin area and then go to plugins scroll down to Your Members plugin (if you have lots of plugins it maybe on the second page) and click activate.

Your Members adds a menu on the WordPress main menu. To complete the installation click on the Your Members option on this menu. You will be asked to add an email or key to activate the software. If you purchased directly from yourmembers.co.uk this will be your email address. Once the API key has been added you will be asked to accept the TOS and license agreement agree and submit.

Congratulations! You have just completed the hardest part of the setup. If everything has gone right you are now looking at your Your Members dashboard and you will see at the top of the page a blue box setup wizard. For the time being you can close that wizard by pressing the x in the top right of the wizard (don’t worry we can bring it back at any time via the about page). For the rest of this tutorial when we refer to the YM admin area we are referring to this part of your WordPress admin site. Within the YM admin area it has it’s own menu system at the top of the page so if I was to refer to YM Admin -> Memberships I mean click the membership menu. You will see a sub menu normally so YM Admin -> Memberships -> Packages would mean navigate the menu to the packages page which is on the sub menu of Memberships.

 

Configure Payment Gateway

Our first thing to configure is our payment gateway which will allow us to take payments. To do so visit YM admin -> Membership -> Payment Gateways. Before activating your payment gateway select a currency, this is the global currency by default it is US dollars and for this example we shall leave it as such.

Next, if it is not already activated, click active on PayPal Web Standard (Your Members has a range of gateways but today PayPal Web Standard is still the most used gateway). You can have multiple payment methods enabled but for today we just want PayPal active, so activate it and once active, you should be re-directed to the PayPal specific screen. If you are not, then click edit which will take you to the same place. Add your PayPal email address in the PayPal handle section and select live from the drop down under Mode. Finally select No to Encrypt buttons and save (you can edit the other settings at a later date).

That’s it, your site is now ready to take payments using PayPal. Most gateways are this simple to configure though individual gateways may have additional settings, information on what is different is shown in a yellow box at the top of the payment gateway.

 

Adding Packages

What is a package? A package contains all the information that is applied to a member’s subscription. So it contains information like duration, price, package account type (access control), where the member should be redirected on login etc. When system applies a package to a member it becomes a subscription, you can modify individual subscription information but the base information comes from a package. In Your Members you can have an unlimited number of packages but we are just going to add one, an ongoing monthly subscription.
Monthly Subscription
So let’s create the package which members will be subscribed to. Begin by navigating to YM admin -> Membership -> packages by default Your Members has already created some typical packages. To add a new package click “add new package” which will bring you to a form, on the right hand side there is a drop down, with basic, basic with trial and advanced as options for the time being leave this to basic and fill in the form.

For this site we are only having one membership but we always want to keep in mind we might be expanding it in the future so give it a descriptive name. This is only shown to the admin user so if you really want to call it “schmucks” you can do and your users will not be aware (though I hope no one thinks of their members that way). Next specify a price, there is no need to add digits unless you want to; for example if you set to US dollars (in the payment gateway) and want $9.99 you would put in 9.99 in the Price option, if you want to $10 simply put 10 in the Price.

Note mainly for Europeans: please use . rather than , when specifying price – 9,99 will not work but 9.99 will.

For this example we shall set the price to 10.

Next we need to select or create a Package type. This determines what content a user has access to by default. When protecting content an admin selects one or more package types to have access to content. Multiple packages can share the same package type, which is often referred to as package account type within our documentation. You can create a new package account type later, but for this example we are simply going to use Member.

Our Tip: You will see two other package account types: Guest and Free. These are always in the system as they manage non logged in users (Guest) privileges and a fall back mechanism (Free). Remember, you determine what package accounts see what content so a member will never see content you don’t want them to even if they end up on one of these package account types.

Finally, we will set a duration. By default a subscription is ongoing (we can change this in the advanced menu) but for the time being we will set this to 1 month. This means each month a payment of $10 will be taken from the users account until they cancel the subscription. Click save to save this package.

That’s it, we have created our first package for users to subscribe to. It’s a monthly package that costs $10 with the package account type of Member. We can now remove the other example packages by clicking the delete icon, each package you delete you are asked what to do with existing users, simply select from the drop down the package we just created. Finally just make a note of the package ID as it is used to reference the page in shortcodes which we will be using later.

 

Creating a Registration Page

Now we have created a package to subscribe users to our site it is time to create a registration form so that users can join. To build a registration form we use something YM calls a custom registration flow. If you have used Gravity Forms or a form builder this will be familiar to you.

In this example we are going to build a very simple form using the existing custom fields. You can add more custom fields by navigating to YM admin -> Members -> Custom Fields.

Our Tip: Think about what data you want to collect on registration. Start with essential data, so what information do you need to record the sale, what data does the tax man need, what data do you need to contact a user. Then think about what data will help improve your site or revenue. The key is to find a balance between getting the data you need/want and not putting potential members off. Remember people are more likely to fill in forms once they have purchased so you may want to limit the number of fields at registration.

However, for now navigate to YM admin -> Memberships -> Registration Flows. A custom registration flow is made of pages. A basic registration flow has 2 pages, a page to collect information and a page to make payment. It’s important to note you cannot collect information on the same page as a payment action.

On the registration flow add a new page (this is towards the bottom of this page). Give this flow page a name, for example “details”. On the right hand side you have various elements you can add to the flow, within the common section add email and username.

Note: The shortest registration flow possible is just email field on page 1 and a payment action on page 2.

If you do not select a password the system will automatically send the user a new password, so we will leave the password field for now. Next select custom, which is where user custom fields are stored and select First name. So now our flow has username, email and first name. For the time being that’s enough information, save the flow page by clicking “process flow control”.

Next create a second flow page (name it something like “Payment”) and add from the Payment option “make Payments with PayPal”. This will allow users to make a payment. By default this will show a PayPal button the second page which will take users to PayPal when they click, but we want to automate this so on the left hand side where the PayPal options are, change the payment button to payment action using the dropdown menu. Save this flow page and give it a handy name like payment.

The final part of the flow is to bring those pages together, so on the Flow control page click new flow towards the top of the page. This will bring you to a similar management screen. Once again give your flow a name (none of these names are shown to the end user) but this time on the right hand side you can see the two pages you created. Drag the details page over to the left hand side, and then do the same with the payment page. Save the flow. On saving the flow you are taken back to the flow control management screen, you can see your newly created flow. Make a note of it’s ID as it will be needed in a minute.

We now have a registration flow which has two pages a details page with username, email, first name and a second page that will automatically take us to PayPal. Our next step is to make it appear on a page so users can use it to register with.

To do in WordPress admin add a new page on this page add the following code: [ym_user_is role=”administrator”]Remember you are an admin logout to test this flow, or you will lose your admin status[/ym_user_is] [no_access] [ym_register id=xx flow=yy] [/no_access] [user_has_access] You are already registered [/user_has_access]

Change xx to be the package ID you jotted down earlier and yy to be your flow ID. Finally on the right hand side you will see a your members protection panel, with several tick boxes, tick “member” from the list. We will explain the other shortcodes on the page in a bit, though its enough to say they are there to protect people who have registered from trying to register again.

Our tip: It’s important to remember flows can be used to register and upgrade users as well as update individual fields. Each package is associated with a WordPress role by default it’s subscriber. Therefore if you are an admin you do not want to test the registration flow while logged in as an admin or you will find yourself no longer an admin but a subscriber.

That’s it, you have now created a registration page. Which when a user registers will ask them for some basic details before taking them to PayPal to ask them to set up a subscription of $10 a month on going. Congratulations you have a membership site up and running!

 

Protecting Content

Now your site is setup to allow people to pay for access it’s probably a good idea to protect some content or your new members may feel a little cheated. As you have seen protecting content in a page or post is very easy with shortcodes. There are 4 main shortcodes that are used in Your Members these are: private user_has_access no_access ym_user_is The first two are almost identical except the private tag displays a generic message (i.e you do not have access to this content) which you can define where as the user_has_access shows no message if the user does not have access. to make use of the private or user_has_access tag’s you must select one or more package account types from the right hand panel on the write/edit interface for a post or page as you did for the register page you created.

So for example let’s create a sample page with the following: [private] This text will be seen by people who have access, and a message will be displayed if not [/private] [user_has_access] This text will be seen by people who have access, otherwise nothing will display [/user_has_access] [no_access] This text will display if a user has no access, otherwise nothing will display [/no_access]

On the right hand side select member as an option. As an admin when you view the page all 3 bits of text will appear. If you log out where the private shortcode is on the page will be replaced with the generic message and the content from within the no_access shortcode will show. If you log in as a user with a member package account type you will see the content inside the private shortcode and the user_has_access shortcode but nothing will appear where the no_access shortcode is.

This system allows you to build very flexible sites, if you want to protect an entire page simply wrap all the content in a private or user_has_access shortcodes.

Our Tip: Your Members protection is opt in, if you do not select something from the right hand box on a page or post then it remains unprotected. You do not need to select Guest for users to have access, unless you have select one or more other package account types on that page. This way you have complete control over what is protected and when. Setting up Your Members won’t suddenly make your site vanish.

The final shortcode tag that is useful is the ym_user_is. This is different as it does not determine if the user has access by the permissions associated with the post (by clicking on the right hand side panel) but from the arguments of the shortcode. It has several different options for example: package package_type role We have already seen role in our register page which was being used to warn administrators not to register in the flow.

[ym_user_is role=”administrator”]Do not enter this flow[/ym_user_is]

We can also use it to check by package for example [ym_user_is package=xx]You are a member which is subscribed to the package with ID xx[/ym_user_is]

or a package account type: [ym_user_is package_type=”member”]You are a member which has a package account type member[/ym_user_is]

So now we know how to protect content we can either start going through older articles and protecting them or creating new articles adding shortcodes as we create new post or pages.

 

What’s next

We now have a fully functioning membership site, which is setup to take payments via PayPal, has an ongoing monthly subscription and can specify if content should be shown to members. As you will have seen while following this tutorial there are lots of interesting options with how to configure Your Members and no two membership site setups need be the same. Some things we haven’t covered in this tutorial but are available as tutorials on the Your Members main documentation are: building profile page to allow your users to change their details or to cancel their subscriptions, setting up more complex packages, handling expiring and cancelled users, and using Your Members Pay per post and bundle systems to buy one off articles.
⚠️ **GitHub.com Fallback** ⚠️