Shortcode for content view access restriction

Shortcode for posts/pages content view access restriction is available at User Role Editor Pro starting from version 4.7. Enclose restricted content with this shortcode
[user_role_editor roles="role1, role2"] some restricted content [/user_role_editor] and you will restrict access to the part or the whole content of any post or page.
After that restricted content will be available for the logged-in user with one of the roles you input for the roles attribute of the [user_role_editor] enclosing tag. Pay attention that You should input the role identificator, not the role name. For example, valid shortcode will be [user_role_editor roles="contributor"], not [user_role_editor roles="Contributor"]. Pay attention to the lowercase 1st letter at “contributor”.
For all other users including the guest visitors restricted content, enclosed by the shortcode described above, will be hidden.

If you wish to show some content for not logged in (guest) visitors only, use this shortcode [user_role_editor roles="none"].

To show content inside shortcode to all logged in users except users with selected roles, included them into the ‘except_roles’ attribute. For example, if you don’t wish to show some text to the ‘subscriber’ role and other not logged in visitors use this shortcode:
[user_role_editor except_roles="subscriber, none"]some text to hide from subscribers[/user_role_editor].
‘none’ is a virtual role ID used by URE for not logged-in users

Starting from version 4.8 other shortcodes enclosed inside User Role Editor shortcode are processed recursively.

  • David Howard

    Great Plugin by the looks of it, but do you have the ability to limit access to whole pages by way of checking a box like in Justin Tadlock’s Members plugin.

    A logged-in user can simply check a box to check a box to grant permissions to view the page.

    See the attached image.

    This would be a really neat feature, and much more user friendly rather than having to write out short code and type in all the user roles – a little time consuming – but great for users wanting to limit sections of a page!

    • Current version has no such feature. I agree with you that it would be
      the great addition. I included this task in my “todo” list. I suppose to add this feature with next plugin update.