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.

I've a problem with permission. Is there a specific permission to let an user with Editor Role, manage the custom menu of a theme, and only this options?

The item that is under Appereance -> Menu, to be clear.

I'm using the capability plugin. Must I write a custom hook to enable only the use of custom menu editor ?

TIA

Edit: I've code a simple solution. See below my answer!

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

You need to give the editor role the 'edit_theme_options' permission, but that will also unlock other theme options like widgets to those users.

share|improve this answer
    
Yes, true. This was what I did. This is not exactly what I need. Thanks. I'll try to write a custom hook... –  keatch Feb 3 '11 at 13:54
add comment

Ok, I've found a way, using the admin_menu action. I post here, in case someone needs it.

This code remove for a specific user all the submenus items except the one for the custom menus in the Appereance menu.

add_action('admin_menu', 'enable_only_custom_menu');

function enable_only_custom_menu() {
    global $menu,$submenu;
    global $current_user;
    get_currentuserinfo();

    if ($current_user->user_login == 'username') {
        foreach($submenu['themes.php'] as $key=>$smenu) {
            if ($smenu[2] != 'nav-menus.php') {
                unset($submenu['themes.php'][$key]);
            }
        }
    }
}

You must iterate the submenu for the key 'themes.php' and deleting all the items that are not interisting for you.

share|improve this answer
    
Unsetting the menu item may literally stop the user accessing a given page, but that doesn't necessarily mean they can't perform a given action. I'm thinking out loud here, but i'd suggesting looking at $wp_post_types and tweaking the nav menu post-type. When i say tweak i mean hook in and swap out the required capabilities for that type with custom ones(then you can assign those caps as you choose). –  t31os Feb 4 '11 at 0:21
    
..following on... Nav menus are post types, so like any other post type they have a set of capabilities required to manage them, hooking in at an appropriate point might provide a means for tweaking the capabilities required to manage that post type(custom caps, or whatever). –  t31os Feb 4 '11 at 0:24
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.