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'm trying to grant the user role 'editor' to have access to the Users top-level menu, and then control which sub-menus they have access to. The add_action lives in the _construct method.

add_action( 'admin_menu', array( $this, 'action_admin_menu' ) );

public function action_admin_menu() {
        $edit_contributor = get_role( 'editor' );
        $edit_contributor->add_cap( 'edit_users' );
    }

I'm expecting the Users menu to appear for an Editor, but it's not working.

share|improve this question

1 Answer 1

I am not claiming this is a canonical list but the user related capabilities I see are:

  • add_users
  • create_users
  • delete_users
  • edit_users
  • list_users
  • promote_users
  • remove_users

I got this working with only list_users and edit_users. I did test all combinations of those, just a few obvious ones. Of course, you may want more capabilities than that.

share|improve this answer
    
What hook did you use: admin_menu or admin_init? The editor had access to the Users menu? –  AlxVallejo Jan 29 '13 at 18:08
    
Ah, nevermind, this was a caching issue. –  AlxVallejo Jan 29 '13 at 18:11
    
I didn't use a hook. I used a plugin to mess with the capabilities. Sorry, I thought the issue was only with "which capability" not with the broader hook function. –  s_ha_dum Jan 29 '13 at 18:11

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.