UPDATE: Download is now available from the Wordpress.org Plug-In site. You can now download the plug-in at the Wordpress.org site!.
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 where <level> is the user level. End the section you want to hide with the tag .
Sorry, you can't see this unless you are at User Level 2 or greaterwill 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 plug-in.
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 in the right sidebar, and please chip in. $5 goes a long way to help keep things running!
kat | June 19th, 2008 at 10:39 am #
the download does not work
rexreed | June 19th, 2008 at 11:10 am #
Fixed the download link -sorry about that!
Troy | June 30th, 2008 at 8:00 am #
Great idea, but why levels? why not roles or categories?
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.
solzenic | September 18th, 2008 at 8:33 am #
hi, could you repair the link, please.
chase | October 17th, 2008 at 6:25 pm #
Anyway you can fix the link so we can use your plugin?
carlnunes | December 2nd, 2008 at 3:26 am #
Sounds good! Can I check the plugin?
rexreed | December 7th, 2008 at 12:15 pm #
Hi all! Great news - I was able to get the Show User Level Content plug-in up at the Wordpress.Org plug-in site.
I will update this page, but you can now download the plug-in at the Wordpress.org site!
Okoth | January 16th, 2009 at 2:32 am #
Wonderful plugin, Rex. I am using Wordpress 2.7 and it works like a charm!
Okoth | February 2nd, 2009 at 4:28 am #
Sorry, I have to correct myself. In Wordpress 2.7, the [hide ] and [/hide] work only with the first part I want hide. When I use the [hide] and [/hide] later on in the same text, people who are not logged in can see [hide ] and [/hide]…
rexreed | February 4th, 2009 at 1:21 pm #
Hello Okoth — thanks for pointing out that bug! I’m going to try to fix it this weekend. Stay tuned.
Penny Haynes | March 19th, 2009 at 12:09 am #
Rex, you are a genius, as I’ve been killing myself to figure this out, but I need some additional help to apply your functions to another plugin. I am willing to pay you to help me just understand your plugin and how I can integrate what you have accomplished to put it into another plugin to stop it from showing a feature if the User isn’t logged in and isn’t a Contributor.
Please contact me asap about this. Thanks in advance for your help!
Penny Haynes | March 19th, 2009 at 12:19 am #
Actually, I’ve tried the plugin, and it’s not really working for me, but I still need your help and am willing to pay you to help me figure this out and understand the wp functions so I can access them.
rexreed | March 19th, 2009 at 6:01 pm #
@Okoth — Fixed the problem with multiple [hide] statements. I’ve updated the plugin. Check it out at:
http://www.fourhourworkweekdiary.com/2009/03/19/testing-version-02-of-show-user-level-content-plugin/
It might take a few hours for the Plugin repository to kick in. You’ll know you have the updated version if the version is 0.2 in the repository and in your WP plugin manager. Drop me a note if this works for you.
rexreed | March 19th, 2009 at 6:10 pm #
Penny - not sure I understand what is not working for you. I’ve dropped you an email, so please respond with how I can help. Which other plugin are you trying to apply this to?
JC | April 27th, 2009 at 9:12 am #
I just installed this onto 2.7.1 of Wordpress and gave it a little test. All I am seeing is the tags for [hide][/hide] - whether logged in or not and it doesn’t hide anything. I set the user level to 0 - I assume this is the level that it should be hidden for ?
But in any case not working here. Some more detailed documentation would help as well, I notice with a lot of plug-in authors you don’t get a lot of people giving detailed documentation on usage. Perhaps this plug-in works however with the lack of usage guidelines other than what has been mentioned I haven’t seen this working. The settings area and explanation on how to configure it is vague as well and should be explained more. Sorry for the critique but I just wanted to give an honest view of what I find as an end user difficult to understand about this.
DavyB | April 30th, 2009 at 9:58 pm #
seems to duplicate the hidepost plugin which does have levels and can hide link addresses also. and is known to work with 2.7.1 and the displayed messages can be configured or made to be blank.
[hidepost]logged in can see this[/hidepost]
[hidepost=2]user with level 2+ eg author can see this [/hidepost]
mssmotorrd | May 3rd, 2009 at 7:55 am #
It’s the first time I commented here and I must say you share us genuine, and quality information for bloggers! Good job.
p.s. You have a very good template for your blog. Where did you find it?
rexreed | May 18th, 2009 at 3:30 pm #
Hi JC –
Thanks for your comment. I’m trying to diagnose this problem, as I can’t seem to replicate it here. Do you have a post where you are trying to use the plugin? Also, did you indicate a User Level at or above which the text will be hidden?
For example, the usage of
[hide 2] This text is hidden for those below level 2[/hide]
Will hide the text for those levels not logged in, or those logged in, but below user level 2.
Can you see if that works for you? I need a good plugin to show the code, so that it doesn’t actually try to execute it on the site.
Thanks,
Rex
rexreed | May 18th, 2009 at 3:31 pm #
@DaveB - good post. At the time, that plugin didn’t exist, but I will take a look at it now. Anyone have good feedback on that?