Featured Posts

The Four Hour Body and You Like many of your Tim Ferriss fans out there, I've been very keen to try the Four Hour Body lifestyle change. I'm overweight by quite a few pounds, so I made a New Year's resolution to shed some pounds....

Read more

Improvements and Fixes to WP E-CommerceImprovements and Fixes to WP E-Commerce Like many of you, I am a user of the WP E-Commerce plug-in for Wordpress as well as a Gold Cart upgrade customer. While WP E-Commerce has many excellent features and does wonders for the Wordpress-based...

Read more

Credit cards: a lifeline for cash Hi all. It certainly has been a while since I've last posted. That's because in many ways the 4HWW concept has been shot given the urgency of making ends meet and scrambling to get whatever dollars are...

Read more

Version 0.2 of Show User Level Content Plugin Now Available 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...

Read more

More on Banking... A while back I posted about business banking accounts, and asked the community what their thoughts were on the best ones for FHWW'ers. I never really did get a good response, but the post is out there,...

Read more

twitter

Follow on Tweets

  •  

Version 0.2 of Show User Level Content Plugin Now Available

Category : life balance, Uncategorized

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 greater

Here’s another hide statement:

Sorry, you can't see this unless you are at User Level 2 or greater

This 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!

Required FTC Disclosure:


This blog is a personal blog written and edited by me. For questions about this blog, please contact Rex at info [at] fourhourworkweekdiary [dot] com. This blog accepts forms of cash advertising, sponsorship, paid insertions or other forms of compensation. The compensation received may influence the advertising content, topics or posts made in this blog, including the article written above. That content, advertising space or post may not always be identified as paid or sponsored content. The owner(s) of this blog is compensated to provide opinion on products, services, websites and various other topics. Even though the owner(s) of this blog receives compensation for our posts or advertisements, we often give our honest opinions, findings, beliefs, or experiences on those topics or products. The views and opinions expressed on this blog are purely the bloggers' own. Any product claim, statistic, quote or other representation about a product or service should be verified with the manufacturer, provider or party in question. This blog may contain content which might present a conflict of interest. This content may not always be identified.

Comments (11)

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?

Post a comment