WooCommerce User Role, Permission & Access Control Plugin

By Peter Nyiri | Sales funnel creation

Jun 26
User-Roles-in-WordPress

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:

  1. Administrator
  2. Editor
  3. Author
  4. Contributor
  5. Subscriber

WooCommerce User Roles

When you install WooCommerce, it registers two additional user roles. These are:

  • Shop Manager
  • Customer

Furthermore, it gives additional capabilities for the Administrator to:

  • Manage WooCommerce Settings
  • View WooCommerce Reports

Access Control

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.

Create/Add User Role to WooCommerce

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.

Members plugin roles

The components are the following:

  • Edit Roles: Edit your user roles and their capabilities.
  • New Roles: Create new roles for use on your site.
  • Content Permissions: Adds a meta box on your write post/page editor that allows you to restrict content to specific roles.
  • Widgets: Adds a login form widget and user-listing widget that you can use in any widget area on your site.
  • Shortcodes: Creates shortcodes that you can use to restrict or allow access to certain parts of your posts and pages (or any other shortcode-capable area).
  • Template Tags: New functions for use within your WordPress theme for various things.
  • Private Blog: Allows you to create a private blog that can only be accessed by users that are logged in (redirects them to the login page).
  • Integration: Members is highly recommended by other WordPress developers. Many existing plugins integrate their custom roles directly into it.

Change User Role After Purchase In WooCommerce

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…

funnelxpert-courses

The user will gain the role “Google First Page”.yith role changer

I have a specific role that has all free courses assigned to it.

Product Prices In WooCommerce Based On User Role

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.

Customizing Existing User Roles

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.

Conclusion

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.

Follow

About the Author

I'm building my 5-figure blog and sales funnel and help other bloggers do the same. You are welcome to join and learn from my experience and mistakes! Are you ready for this?

Leave a Comment:


Fatal error: Uncaught ArgumentCountError: Too few arguments to function Jetpack_Subscriptions::comment_subscribe_init(), 1 passed in /home/funnelx/public_html/wp-includes/class-wp-hook.php on line 286 and exactly 2 expected in /home/funnelx/public_html/wp-content/plugins/jetpack/modules/subscriptions.php:602 Stack trace: #0 /home/funnelx/public_html/wp-includes/class-wp-hook.php(286): Jetpack_Subscriptions->comment_subscribe_init('') #1 /home/funnelx/public_html/wp-includes/plugin.php(208): WP_Hook->apply_filters('', Array) #2 /home/funnelx/public_html/wp-content/themes/pressive/comments.php(54): apply_filters('comment_form_su...', '') #3 /home/funnelx/public_html/wp-includes/comment-template.php(1510): require('/home/funnelx/p...') #4 /home/funnelx/public_html/wp-content/themes/pressive/fullwidth-page.php(178): comments_template('/comments.php', true) #5 /home/funnelx/public_html/wp-includes/template-loader.php(78): include('/home/funnelx/p...') #6 /home/funnelx/public_html/wp-blog-header.php(19): require_once('/home/fun in /home/funnelx/public_html/wp-content/plugins/jetpack/modules/subscriptions.php on line 602