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

  •  

New WordPress Plugin: Show User Level Content

Category : Uncategorized

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 greater

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

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 (29)

the download does not work :(

Fixed the download link -sorry about that!

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

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.

hi, could you repair the link, please.

Anyway you can fix the link so we can use your plugin?

Sounds good! Can I check the plugin?

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!

Wonderful plugin, Rex. I am using WordPress 2.7 and it works like a charm!

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]… :(

Hello Okoth — thanks for pointing out that bug! I’m going to try to fix it this weekend. Stay tuned.

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!

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.

@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.

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?

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.

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]

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?

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

@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?

Yes, that what i need,
with this plugin i can make membership site with wp
Thanks rexredd
feedback after installation

Iam sorry rexredd, if you still support plugin
i have a blog for downloaded links and i want to hide links from visitors , to be only available for registered users
i use wp 2.8
i tried all codes but not working
have u any suggestion for code?
Thanks

Hi Rex,

I want to use this plugin with a membership plugin called “WishList Member.”

Would like assistance in setting your plugin to work with theirs.

Are you available for custom coding or mods?

Kirk

Hi Kirk —

Good to hear from you. I’ve actually made a number of significant improvements to the Plugin – I’ll post about it later this week. In the meantime, can you let me know how the existing plugin is not working with the plugin you mention? Also, can you post a link to the plugin you’re talking about above?

Tnx!

Hi Rex,
I hope that you can somehow merge your plugin with WP-Sentry.

I like the idea of hiding contents to those who aren’t registered and logged in, but it’ll be even greater to hide specific contents to specific group users. I had communicated with Pete Holiday, the developer of WP-Sentry, and he mentioned that he can incorporate such features but it wouldn’t be fail-safe if the plugin fails.

Therefore, I’m wondering if you might have a different approach to this problem. Your suggestions will be valuable in enhancing either plugins further.

Cheers,
Jason :-)

Hi there, I had a question for you…

From what I’m reading this decides what to show based upon levels that are equal to or less than. Meaning someone of level 5 will see anything less than their level.

Is there a way to show something only to an EXACT level? Like content a to level 3, and content b to level 4, etc. In this case, level 5 would not see these as it is not specifically level 3 or 4.

Yes, in fact, I have a new version of the plugin! I will be posting it shortly, and it has a lot more features including using operators (> and <), allowing multiple hides and using names of roles instead of access levels. I hope I can post it by Friday – stay tuned!

Hey Rexreed,

Maybe it’s just me but what frustrates me the most is when there is next to zero for documentation. It wasn’t until someone asked that there was an actual example and instruction on how to use this plugin. It’s like there is some assumption that we all just know how it works.[/rant]

I have been searching for something like this for about a week and was happy to see this!

Is there something ‘else’ that I need for this plug in to work? I tried the tags [hide][/hide] and non-logged in users could see the ‘hidden’ text. Funny thing, in Chrome, and while logged in as admin, I could see everything _but_ the [/hide] part. Very odd.

Now, to complicate things a little (isn’t there always some sort of complication?), I want to use this with a classified plugin to hide the sellers contact information. But first, I got to see it working with a regular post, which it currently does not.

Necessary info:
WP 2.9.2
SQL 5

Thanks.

DragonDon

Hi,have you finished submitting the newer version?
I download version 0.2 from wordpress but it seems dosen’t work
I type code like this [hide 3]hidden content[\hide] but it dosen’t work
My wordpress’s versionis 2.9.2

Post a comment