- This topic has 3 replies, 2 voices, and was last updated 15 years, 10 months ago by nv1962.
-
AuthorPosts
-
January 17, 2009 at 1:58 am #540nv1962Member
This is a feature question, not a feature request: is there a way to show a menu item <i>only</i> if the user is logged in with a given role level (or higher)? I.e. what I’m trying to figure out is if there’s a way to show a pseudo-secret menu item only to logged in users with certain roles (think: private area). I’ve seen <a href="http://wordpress.org/extend/plugins/user-access-manager/">this plugin</a> but given its beta-status (although I’m seeing it’s pretty well-evolved now) I’m not too sure if there’s another way to accomplish that, without hacking away at WP core files.
January 17, 2009 at 2:05 am #4665imported_RyanMemberHmm, interesting idea. You would need to code that directly. The plugin can’t do it itself.
I actually use that method on http://dunedinicehockey.hellyer.kiwi/, albeit that site doesn’t use a dropdown menu.
You don’t need a plugin for it BTW, the coding is pretty simple. I’ll look itup and be back shortly with a script for you.
January 17, 2009 at 2:26 am #4666imported_RyanMemberI thought it was easy. Having trouble finding how to check what use role someone is though ” title=”Sad” />
January 17, 2009 at 2:36 am #4667nv1962Member<s>I hope I’m posting in time although if you can post that snippet I’d be more than obliged as</s> I found that that plugin I linked to above does <i>exactly</i> what I want.
For the takers: you have to create a separate "Group" to which you (as the admin) can assign members, by going to each (intended) member’s profile page and checking the membership box for that Group.
Then, in the Page Settings section of the User Access Manager plugin (it requires >= WP2.7) you select "Hide complete pages" ("Yes") which will ensure that <i>only</i> the assigned members of the group in question can see the menu (navigation) items assigned to it.
Finally, on every page that you want to be accessible only to a specific group, you select the check box for that Group (under "Access") and presto! The corresponding menu item of that page is visible <i>only</i> to members of that Group. You could this way even have several, different "secret" areas / pages for different groups, each only seeing "their" pages (and corresponding menu items). Of course, as the admin, you see everything – but the "secret" (locked behind user credentials) pages are marked visibly for the admin with a tailing [L] added to the title, so you always know what’s "secret" or "protected". The non-group member doesn’t see the "hidden" menu items at all.
Bonus feature of that plugin: you can also indicate certain filetypes – via the file extension – as access-protected (it’s accomplished through a .htaccess mod handled by the plugin, managing also the corresponding .htpasswd file) so that uploaded files are accessible only by the members of that assigned group with access granted.
Thought I’d mention that solution… It’s really awesome, how plugins can create a fully-featured, tailor-made and rich CMS out of WordPress.
<s>Still, as it’s a rather feature-rich plugin: if you have a more efficient code hack, I’ll take that instead! (I’m not using the extra functionality of User Access Manager, so…)</s>
<b>Added later:</b> ack – too late… Sorry about that, Ryan!
-
AuthorPosts
- You must be logged in to reply to this topic.