WordPress has a user role management system which defines what a specific user can do on your website. WooCommerce can use this to restrict content and grant access to products on purchase. Permissions can be edited with the help of plugins.
When you install WordPress, there are five default user roles:
When you install WooCommerce, it registers two additional user roles. These are:
Furthermore, it gives additional capabilities for the Administrator to:
Access to posts, pages and custom post types such as products can be restricted by user roles. Any existing role can be used to restrict access and you can create as many different roles as needed to protect entries, so that only members of the corresponding groups can view them.
As an example, you could have a user role “SEO Course” and with a membership plugin you can set that only this user role would have access to the SEO Course offered on your blog.
If you want to add an extra user role to WordPress, you need to use a plugin. The most basic plugin to do this is called Members. It is a user, role, and content management plugin. Its purpose is to make WordPress a more powerful CMS by giving you control over the users of your site.
The components are the following:
The above plugin is missing one key element: Assigning a user a certain role when he makes a purchase.
If you sell digital products, this feature is vital.
After you have created the needed user roles with the Members plugin, the YITH Automatic Role Changer plugin allows you to automatically assign roles to your customers following a specific purchase or amount spent.
Note: After creating roles you can even uninstall the members plugin so that you don’t have too many plugins working.
In this example, when someone purchases my online course Blogging On The First Page Of Google…
The user will gain the role “Google First Page”.
I have a specific role that has all free courses assigned to it.
You may also want to have a site where people with a certain membership level can get discounts.
As an example, those who are registered users or those who pay a monthly fee.
Default WordPress user roles are designed to have capabilities that fits the requirement of most websites. For example if you run a magazine site, then you can assign Editor user role to your senior staff and author user role to the junior staff. You can assign contributor user role to your guest authors and subscriber user role for your site visitors.
But what if you wanted to modify the permissions of an existing WordPress user role?
One thing we do not like about the author role is that not only can they publish their own posts, but they can also delete them after it’s published. This can undermine your entire editorial workflow. Also can be disastrous if a paid author leaves on bad terms and decides to delete all the posts they wrote (the ones you paid them for).
Let’s suppose that you want to modify the author user role, so that the authors cannot delete their posts once they’re published.
First thing you need to do is install and activate the Capability Manager Enhanced plugin. Upon activation, go to Users » Capabilities to modify user roles.
Next, select the user role you want to edit from the top box in the right column and then click the load button. This will load users capabilities in the boxes on the left.
All you need to do is uncheck the capabilities that you want to remove from that user role. For example, in this case we want to remove the capability to delete published posts from authors. We will uncheck ‘Delete Published’ capability. Once you are done, scroll down to the bottom of the page and click on the save changes button to store your settings.
User roles in WordPress help in providing a stable structure and organization to varied users of your site. Moreover, it helps you create selective access to your site’s content.