18 Jun, 2008 in Uncategorized by rexreed

New WordPress Plugin: Show User Level Content

Like many WordPress users, I often have the need to segment my content for different user audiences. While plugins like Post Levels and Disclose Secret are good ways of hiding entire posts from users that don’t meet a certain minimum user level, I couldn’t find a good plugin that did that for parts of a post. I did manage to find a few that would hide parts of a post from unregistered users, but not one that would give you control over which user levels could see that post.

To meet that need, I created the Show User Level Content plugin. This plugin is quite simple. If you want to make a certain part of your content accessible only to users of a specific user level, enclose them with the tag [hide <level>] where <level> is the user level. End the section you want to hide with the tag [/hide]. For example, [hide 2]Only show this content to users of level 2 or higher[/hide] will show the encapsulated content to users of level 2 or higher.

I based this plugin on another plugin that simply used the [hide] tag without the <level> modifier, but I can’t remember where I saw the code for that. If you wrote that plugin, let me know, so I can give you credit!

Installation:

Simply copy the attached file to your /wp-content/plugins directory. Go to the Plugins configuration page in WordPress, and activate. That’s it.

Customization:

If you want to customize what text users see when they are unable to view the privileged content, go to the Plugins administration page and you should see a page for “Show User Level Content Configuration”. Click on that link and you will be taken to a page where you can customize the “exception text”. This is the text that will replace the hidden text users can’t see.

Compatibility: I built this on and for WordPress 2.5.1. I’m not sure if it will work on older versions. I’ll try to keep it up to date for future versions.

Download:

Click here to download theĀ Show User Level Content file.

Feedback:

This is just a version 0.1 plugin! I’d love your feedback to help me make this better. If you know of a better plugin than this one to accomplish what I’m doing, please let me know ASAP so I don’t have to continue development ;)

Contribute: Hey folks, I’m doing my best to keep my head above water and allocate my time to the most valuable tasks. Some of the other plugins in this area have died because no one cared enough to let the author know its value. The best way to let me know is to contribute to my Muse fund on the right side of this blog. Check out the Chip-In widget, and please chip in. $5 goes a long way to help keep things running!

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Furl
  • ThisNext
  • MisterWong
  • Wists
  • Technorati
  • NewsVine
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon

4 Responses so far | Have Your Say!

  1. kat - Gravatar

    kat  |  June 19th, 2008 at 10:39 am #

    the download does not work :(

  2. rexreed - Gravatar

    rexreed  |  June 19th, 2008 at 11:10 am #

    Fixed the download link -sorry about that!

  3. Troy - Gravatar

    Troy  |  June 30th, 2008 at 8:00 am #

    Great idea, but why levels? why not roles or categories?

  4. Dustin - Gravatar

    Dustin  |  July 6th, 2008 at 9:02 pm #

    Hello, would you be able to make it so that you can restrict a page to only certain users by entering their username?

    I’d like to make a page for each user to show them user specific content/documents/links but cannot allow others to view their page of documents.

Leave a Feedback

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>