Bainternet WordPress Consultant
  • WordPress Services
  • Blog
    • Fancy Functions
    • ShortCodes
    • How To’s
  • Plugins
    • Post Editor Zen Coding
    • Advanced Code Editor 2.0
      • other older versions
    • ShortCodes UI
    • User specific Content
    • Simple QR Code
    • Sidebar per user role
    • Simple TOC
    • Post Creation Limits
      • Posts Creation Limits older versions
    • User Ranks
      • Bainternet User Ranks v1.0
    • Custom Category Template
    • Author category
    • Simple Gist Embed
    • WordPress Simple Instant Search Plugin
    • GoTo Redirect
    • Simple Google +1 plugin
  • About Me
    • Donations
  • Contact me

User specific Content Plugin

Posted on Apr 13, 2011
Ohad Raz
137 Comments
User spesific content,WordPress Plugin
Plugins
  • Share on Facebook.
  • Share on Twitter.
  • Share on Google+
  • Share on LinkedIn
User specific Content Plugin


Contents
  • Screenshots:
  • What does it do?
  • How does it work?
  • Features:
  • Download:
  • Usage:
  • ShortCode
  • Change Log:

So i saw a question on WordPress Answers that asked

how to display user specific content?

and i remembered that i have coded something like this before, So after a few hours of search my code and snippets files I’ve found it, Fixed it up a bit and now you can use it. presenting User specific Content

Screenshots:



What does it do?

This Plugin allows you to select specific users by user name, or by role name who can view a specific post content or page content.


How does it work?

Basically it adds a meta box to the post or page edit screen and lets the user select specific users by name or roles and then when you call that page content using “the_content();” function it check using “the_content” filter if the current user is one of the users you have selected or if his role match’s the roles you have selected and shows the content, otherwise it displays a message which can be set in that metabox, something like:

Sorry But This Content is for specific Users Only, Maybe log-in???


Features:

  • You can select any number of Users you want by there names.
  • You can select any number of users Roles you want by there names.
  • Easy Customization of content blocked massage.


Download:

Download the latest Version from WordPress.org

Simple Installation steps:

  1. Extract the zip file and just drop the contents in the wp-content/plugins/ directory of your WordPress installation.
  2. Then activate the Plugin from Plugins page.
  3. Done!


Usage:

Simply create or edit post/page and you will see the User Specific Content metabox where you can select your option, then save and that is it.


ShortCode

Since Version 0.7 the plugin comes with a new shortcode (the idea cam from your great feedback and comments) which extends the plugins functionality.
Basic usage of the shortcode:

[O_U user_id="1"]Content goes here[/O_U]

where 1 is the user id. or to specify multiple users you can use:

[O_U user_id="1,2,3"]Content goes here[/O_U]

To limit content by user name use:

[O_U user_name="Bainternet"]Content goes here[/O_U]

where Bainternet is the user name. or to specify multiple users you can use:

[O_U user_name="Bainternet,Steve,david"]Content goes here[/O_U]

To limit content by user role use:

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

where Administrator is the user role. or to specify multiple user roles you can use:

[O_U user_name="Administrator,Author,Contributor"]Content goes here[/O_U]

To change the blocked massage use:

[O_U user_role="Administrator" blocked_meassage="admins only!"]admin content goes here[/O_U]

You can also use the shortcode more then once in a single post:

[O_U user_role="Administrator"]admin content goes here[/O_U]
[O_U user_name="Bainternet,Steve,david"]specific users content goes here[/O_U]

And best of all you can even use it as a template tag:

<?php echo do_shortcode('[O_U user_role="Administrator"]admin content goes here[/O_U]'); ?>

this is it, enjoy and any feedback is welcome, also make sure to submit bug if you find any.


Change Log:

  • 0.9
    • Added nested shortcode support, which means you can filter who sees your shortcodes
  • 0.8
    • quick bug fix., thanks to Amuras comment.
  • 0.7
    • Major update, Plugin rewritten in OOP.
    • New shortcode implemented.
    • New options panel to define User Specific MetaBox.
    • New admin panel.
    • Run filter on the_content as well as the_excerpt.
  • 0.6
    • Fixed all wp_debug warnings.
  • 0.5
    • Quick fixed WP_Debug warnings.
  • 0.4
    • added simply logged-in user content only!
    • quick fixed block by role bug.
  • 0.3
    • Added support for none logged in users content only.
  • 0.2
    • Added page support
  • 0.1
    • Initial release

Incoming search terms:

  • wordpress restrict content to logged in users
  • php user specific content
  • extension bainternet simple toc
  • wordpress content for single user only
  • wordpress download restrict to specific user
  • wordpress limit content to users
  • wordpress login plugin where user can view only few pages
  • wordpress only to specifie user can edit page

Related posts:

  1. Bainternet User Ranks v1.0
  2. WordPress User Ranking
  3. Posts Creation Limits






Loading comments...
  • About the author

    Ohad Raz

    I'm a WordPress Consultant, a WordPress Developer and a WordPress Freelancer
    Currently in my third year of Software Engineering B.Sce Degree.
    I've been developing Websites and web applications on WordPress for over 5 years.
    I live in Kiryat Gat , Israel.

    • Write an E-Mail
  • Other Methods of contact

    My profile on WordPress Answers

    profile for Bainternet at WordPress, Q&A for WordPress developers and administrators

    • My Code Poet listing

    • My Careers 2.0 Profile

    • My Gravatar.com Profile

    • My About.Me Profile

    • Contact Form

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

  • Contribute

    If you like this plugin and want to contribute to future development of the plugin, or simple show your appreciation please consider make a small donation









  • Recent Comments

    • WordPress Developer Ohad Raz on Advanced Code Editor 2.0
    • WordPress Developer anupam on Advanced Code Editor 2.0
    • WordPress Developer Ohad Raz on how to – WordPress Category Extra Fields
    • WordPress Developer Luismin on how to – WordPress Category Extra Fields
    • WordPress Developer Ohad Raz on Advanced Code Editor 2.0
  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

  • Top Posts & Pages

    • how to - WordPress Category Extra Fields
    • WordPress Taxonomies Extra Fields the easy way
    • Custom taxonomies extra fields
    • How I add a WordPress MetaBox


  • About Me
  • Blog
  • Contact me
  • disclaimer
  • Donations
  • home posts
  • WordPress Services
© 2011 by Bainternet WordPress Consultant