Restrict content by User role Levels

Restrict Content by User Role Levels

WooCommerce Membership Made Easy allows you to restrict/allow post/page/custom post type content based on user roles hierarchy without specifying each and every user role. For example: If you allow access to Subscriber user role, other user roles above Subscriber will automatically get access. You can also change the hierarchy of the user roles on your site. You can place your restricted content within the shortcode to limit the access.

Define User Role Hierarchy 

You can define the user role hierarchy by going to Woo Membership Made Easy -> User Role Hierarchy. You will get a screen similar to the following.

user-role-hierarchy

This will display the default WordPress user roles hierarchy.  You can customize it by dragging and dropping the user role items and saving the changes. If you need default hierarchy, just Save the changes without changing the order.

Allow Content for User Role Levels

This feature allows you to allow content for certain user role and user roles above the specified user role or user roles below the specified user role.  You can use allowed_roles attribute to define the user roles for allowing content. Let’s take a look at the usage of this attribute.

Allowing Content for One User Role and Higher Levels

Assuming that you have the default user role hierarchy, following shortcode will allow the content for Author,Editor, Administrator user roles.


[[wmme_private_content  allowed_roles="author-plus" ]
Private Content for Author User Role and Higher User Roles
[/wmme_private_content]]

Allowing Content for One User Role and Lower Levels

Assuming that you have the default user role hierarchy, following shortcode will allow the content for Author,Contributor, Subscriber user roles.


[[wmme_private_content  allowed_roles="author-minus" ]
Private Content for Author User Role and Lower User Roles
[/wmme_private_content]]

[mpc_textblock content_width=”100″ font_color=”#ffffff” font_size=”22″ margin_divider=”true” mpc_tooltip__border_divider=”true” mpc_tooltip__padding_divider=”true” class=”wpexpert-wpro-ad-free-docs-static-text”]WooCommerce Membership Made Easy[/mpc_textblock][mpc_animated_text duration=”1000″ delay=”2650″ text_font_preset=”mpc_preset_17″ text_font_color=”#ffffff” text_font_align=”center” text=”Simple Setup|||Advanced Restriction Rules|||Membership & Private Page Management|||Priority Support” text_border_divider=”true” text_padding_divider=”true” disable_sides=”true” sides_font_preset=”mpc_preset_17″ sides_font_color=”#ffffff” sides_font_align=”center” border_divider=”true” padding_divider=”true” margin_divider=”true” class=”wpexpert-wpro-ad-free-docs-animated-text”][mpc_button preset=”mpc_preset_29″ url=”url:http%3A%2F%2Fbit.ly%2F2sssrw8|||” font_preset=”mpc_preset_20″ font_color=”#ffffff” font_size=”16″ font_transform=”uppercase” font_align=”center” title=”VIEW MORE” background_color=”#2bb3e7″ border_divider=”true” border_css=”border-top:2px;border-right:0px;border-bottom:2px;border-left:0px;border-color:#ffffff;border-style:solid;border-radius:0px;” padding_divider=”true” padding_css=”padding-top:12px;padding-right:32px;padding-bottom:12px;padding-left:32px;” margin_divider=”true” margin_css=”margin-top:11px;” hover_font_color=”#2bb3e7″ hover_background_color=”#ffffff” hover_background_effect=”expand-horizontal” hover_background_offset=”0″ hover_border_divider=”true” hover_border_css=”border-radius:0px;” mpc_tooltip__border_divider=”true” mpc_tooltip__padding_divider=”true” class=”wpexpert-wpro-ad-free-docs-button”]