Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Long time lurker, but first time poster. I've searched Google extensively and just can't seem to come up with an answer on this problem.

I use Justin Tadlock's excellent 'Members' plugin for roles and permissions on several client installations of WP. I've recently deployed a theme where the client should only have access to the Appearance -> Menus item, but none of the others sub-items in the Appearance menu of the admin.

When enabled, the role 'edit_theme_options' enables the user to access 'Themes', 'Widgets', and 'Menus'. How would I go about filtering the submenu so that if the role 'edit_custom_menus' is assigned, the 'Menus' link will show?

share|improve this question
add comment

2 Answers

I don't use plugin myself, so speaking theoretically. There are two parts to this:

  1. Determine if user has role that can see menus. Plugin's documentation describes current_user_has_role() function for this.
  2. Actually hiding menus if role doesn't fit. I don't have anything tested to offer, try this for starters: How to remove menus in WordPress dashboard ( WpRecipes )
share|improve this answer
add comment
up vote 1 down vote accepted

Upon further searching and after discovering the $submenu global variable, I've managed to find a helpful tutorial on removing sub-menus from the WordPress admin.

I'll post with code when I get a full solution implemented and integrated with the plugin.

share|improve this answer
    
some feedback at least would be nice so to know if this question is answered or not :) –  hakre Nov 9 '10 at 19:43
    
Something to note is that WordPress partially determines the required caps to view a page based on the capability set in the menu item, a filter on the admin_menu would allow you to update the appropriate array item with your desired cap... (i'll happily go into more detail if it's requested). –  t31os Nov 17 '10 at 15:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.