Making an update to the Show User Level Content Plugin … finally on version 0.2
This version should allow multiple hide statements in the same post. This is a test of that functionality.
The first line below is going to be hidden for those below User Level 2.
Sorry, you can't see this unless you are at User Level 2 or greaterHere’s another hide statement:
Sorry, you can't see this unless you are at User Level 2 or greaterThis seems to work! Download the new version of the plugin here (altho it might take time for the WordPress Plugin SVN to update):
http://wordpress.org/extend/plugins/show-user-level-content/
Enjoy, and provide feedback!





Hi, will the hide statements work if used in a theme’s “Single Post” template instead of being used in the text portion of a post?
I’m working on a project where I’ve defined a new post type that uses custom fields for some of the data. Each of the several hundred posts will have a custom field that I would (ideally) like to show to only those users with a high enough user level.
To do this, one approach would be to have an additional custom field attribute that defines the user level needed to view each custom field. I haven’t been able to figure out how to do this, if it would even be possible, so I was hoping I could get it to work with your Show User Level Content plugin.
I can get the plugin to work as expected when I use the ‘hide {level}’ tags in the post’s main text field. I then tried putting the ‘hide’ into the “Single Post” template so it could be applied for all of the posts in one go. When viewing the (public view of the) post, the square-bracketed hide tags themselves are visible. Is this because the template is being applied outside the loop or something?
Can you think of any way to make this work? Thanks.
@Matt – Yes, indeed, the plug-in only operates on text inside the loop. To apply the hiding outside the loop (as part of your “hardcoded” PHP), you’ll need to do that programmatically, rather than through the plug-in, since the plug-in doesn’t process the PHP code before it goes through the loop. Check out the PHP function str_replace with some evaluation logic using WordPress environment variables to check the User Level. I think that’s the best route for replacement outside the loop.
Hi,
This is a great idea for a plug-in. I might be slow or something, but I’m having a difficult time getting it to work. I’m using 2.7.1 with the atahualpa theme. I think I’m not doing the right opening and closing tags to encapsulate the privileged text. So if I want only contributors and above to see the content what tags should I surround that with?
Ive tried the following permutations:
[hide contributor] texttexttext [\hide]
[hide {contributor}] texttexttext [\hide]
[\[hide \{level}\] blahblahblah \[\\hide\] <— this was in the plug in read-me file
etc.
Every time I end up with the tags showing up in the text on the live site with no functionality.
Thanks for the help! Best regards
Alan
Hi Alan –
The usage is [hide #] where # is the level NUMBER, not the attribute. So, if you want to hide the text from users lower than level 2, you do [hide 2]. Make sense?
Hi, I was wondering if you have a way to hide pages also?
Thanks
Is there any menu to set the user Levels? How can I set user to a certain level?
To hide a specific content, use the following syntax:
[hide {level}]
{content}
[/hide]
Example:
[hide 1]
You will not see this if you are not logged as subscriber
[/hide]
[hide 2] You will not see this if you are not logged as contributor
[/hide]
[hide 3] You will not see this if you are not logged as author
[/hide]
[hide 4] You will not see this if you are not logged as editor
[/hide]
[hide 5] You will not see this if you are not logged as administrator
[/hide]
1. it works. nice and useful plugin.
2. it is not
[\hide], <strong style=”color: red”it is [/hide] rather.3. on a lighter note, i recommend the change of name of plugin. i analysed and discovered more – far more, search queries for “hide post”, than for show post.
i mean highlight the hide factor more in your description somewhere.
thanks and best wishes.
r
1. it works. nice and useful plugin.
2. it is not</strong
[\hide], it is [/hide] rather.3. on a lighter note, i recommend the change of name of plugin. i analysed and discovered more – far more, search queries for “hide post”, than for show post.
i mean highlight the hide factor more in your description somewhere.
thanks and best wishes.
r
it works. nice and useful plugin. I’m using wp 3.0.1.
To hide a specific content, use the following syntax:
[hide {level}]
{content}
[/hide]
Example:
[hide 1]
You will not see this if you are not logged as subscriber
[/hide]
[hide 2] You will not see this if you are not logged as contributor
[/hide]
[hide 3] You will not see this if you are not logged as author
[/hide]
[hide 4] You will not see this if you are not logged as editor
[/hide]
[hide 5] You will not see this if you are not logged as administrator
[/hide]
Thanks
there is a sub page where the hide code is not working. there is much raw html
is it possible that some html code is breaking your code?