Specify users by name or a role and show them exclusive content

It is easy to show exclusive content for different users on your site. We have already shown you a snippet which allows you to add a shortcode and show content only for logged in or logged out users. But what if you want more control over it?

In this article, we are about to show you User Specific Content plugin which will allow you to create special content for specific users. You can choose users by their names or select user roles for which the content will be shown.

You can select any number of users and user roles, and the plugin will check if they match the criteria for displaying a message. If a user is on the list, the content will be shown while the other folks will get a message you can customize on the plugin’s settings page.

  1. Go to Plugins->Add New
  2. Search for “User Specific Content”
  3. Install and activate the plugin
  4. Open new post or edit an old one
  5. On bottom of the page, search for “User specific content box”

Here you will find several options:

  • By User Role – select a user role which will have access to the post/page content
  • By User Name – select a username which will have access to the post/page content
  • Members and Guests – choose if you want to show the post/page only to logged in or logged out users
  • Content Blocked Message – write a message which will be shown to anyone who doesn’t meet the criteria above

Specify users by name or a role and show them exclusive content

If you want to have even more control over the content, and for example, show only one sentence to logged in users, to administrators or to specific users, you will have to use shortcodes provided by the plugin.

Limit content for specific users:

[O_U user_id=”1, 2, 3″]Write something in here. This will be limited only for users with user_id=”1”, “2” and “3”[/O_U]

Limit content by specific user names:

[O_U user_name=”Dave”]Content goes here[/O_U]

Limit content by user role:

[O_U user_role=”Administrator”]Content goes here[/O_U]

Limit content to logged in users:

[O_U logged_status=”in”]You only see this if you are logged in[/O_U]

Limit content to logged out users:

[O_U logged_status=”out”]You only see this if you are logged in[/O_U]

You can use more than one shortcode on the same page so you can easily combine user names and user roles or anything else you like. If you want to specify the blocked message for a specific shortcode, simply add the following in your shortcode: blocked_meassage=”write something here”. For example:

[O_U user_role=”Author” blocked_meassage=”Sorry, only authors can read this because they’re so cool.”]Hey, authors. You’re cool![/O_U]

That’s all there is. Enjoy your User Specific Content. If you like modifying your website, check out the WordPress basics and learn more about the popular CMS.

START YOUR OWN BLOG

This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

2 thoughts on “Specify users by name or a role and show them exclusive content

  1. Hey, I read your tutorial and it seemed like this is exactly what I am looking for. However, after installing the plugin it doesn’t seem to be working. I saw the plugin hadn’t been updated in a year and had received some negative reviews saying that it didn’t work correctly with newer versions of wordpress. Have you used this recently or do you have any suggestions as to why I may not be able to get this to work on my site. Thanks for your time.

Leave a Reply

Your email address will not be published. Required fields are marked *