FORSMILE
JA
WordPress2016/01/24

How to Add Membership Functionality to WordPress

As you operate a website, you might find yourself wanting to use membership features when your site grows in scale or when you want to create special pages. WordPress allows you to easily implement membership (login) functionality using plugins.

Back to Blog

As you operate a website, you might find yourself wanting to use membership features when your site grows in scale or when you want to create special pages. WordPress allows you to easily implement membership (login) functionality using plugins.

A little PHP knowledge is required for more customized use.

Features Implementable with Membership Functionality

This time, we will implement this using the WP-Members plugin. This plugin enables the implementation of features such as those listed below.

PLUGIN - WP-MEMBERS

You can use the existing user management features in WordPress as they are.

Users added with WP-Members are added as 'subscribers' in WordPress.

Conversely, users added by an administrator in WordPress can also log in.

If an unlogged-in user tries to access a page blocked by the feature, they will be redirected to the login page.

Install from the WordPress Plugin Page

Install the plugin and navigate to the WP-Members settings screen.

WP-Members Options

Login page (you can specify the page to be used for login from static pages)

Registration page (setting a static page for new registrations adds a new registration form to the login page)

User profile page (setting a static page for user profiles allows you to add password reset links, etc., to the login page)

These are the items displayed on the new registration screen and profile. You can set whether to display them via a checkbox or make them required. You can also create new items from 'Add Field'.

You can change the text of automatically sent emails. These are also all in English initially.

ACCESS RESTRICTIONS: HOW TO USE WP-MEMBERS

For All Posts

This is done from 'Content Blocking' in the image above.

For Specific Posts Only

When using the WP-Members plugin, a menu like the one shown above is added to the right sidebar.

The image shows that access restrictions are not applied to all posts. If you check the checkbox, access restrictions will apply only to this specific post.

Make Only Part of an Article Unreadable

To prepare for using this feature, in addition to restricting page access, please check 'Show excerpt'.

When using the WP-Members plugin, a 'more' tag is created within the text tab of the post creation editor.

If this 'more' tag is embedded in a post when page access is restricted, the content before the 'more' tag will be displayed as an excerpt.

To view the content after the 'more' tag, login is required.

USER MANAGEMENT FEATURES: HOW TO USE WP-MEMBERS

You can add functionality to pages mainly by placing shortcodes on static pages.

Register Login as a Widget

The 'WP-Members login' widget is added to the widget settings area of the WordPress admin screen, so place it where you want it.

Register Login as a Static Page

text
[wp-members page="login"]

Account Management Page (My Page)

This is a page where registered users can manage their registered information, passwords, and other details.

text
[wp-members page="members-area"]

New Registration Page

text
[wp-members page="register"]

Finally, for logout, if you access the login page after logging in, a logout link will be displayed.

If you want to place it elsewhere, simply copy the link and paste it where desired.

PLUGIN - IF-MENU

Access restriction to articles is now complete, but this time I introduced membership functionality because I wanted to create a secret static page.

If you want to change the menu only for logged-in users, there's a plugin called 'if-menu'.

Reference article: http://netaone.com/wp/if-menu/

To install, search for it from the 'Plugins' section in the WordPress admin screen and install it.

How to Use

When if-menu is active, an item called 'Enable Conditional Logic' is added to the menu settings.

The conditions are in English, but I'll excerpt the translations from the reference URL above just in case.

Meaning of the Dropdown Options

User is logged in (when the user is logged in)

User is Contributor (when the user is a contributor)

RECOMMENDED WORDPRESS BOOKS

I think many people read books, but I truly feel that you learn more deeply when you actually implement things.

I recommend reading books about WordPress itself and PHP.

Understanding HTML and CSS would broaden your possibilities, but the great thing about WordPress is that you can manage the design part just by relying on templates.

The Easiest WordPress Introduction Classroom (Japanese) - Paperback

WordPress basics. It carefully explains everything from installation.

There are many books available, so any one is fine, but this one is recent, and the author is beautiful.

For those doing serious development. It introduces real-world examples, so it can also be used for brainstorming ideas.

📦
Amazon で関連書籍・ツールを検索
WordPress development book
Amazonで探す →(アソシエイトリンク)