1

I'm having some issues regarding a user's capability on a multisite. So, I have a network of sites and on each site I want a role (Local Admin) to be able to create users.

I've added the capabilities to that role and added a user to that role. When I log in as the user and dump their the returned data from get_userdata function I see the correct role and create_users is set to true. However when I use current_user_can( 'create_users', wp_get_current_user() ) I get false.

What am I missing? Are there any specific capabilities I need to add because I'm using multisite? Any help appreciated!

Thanks.

3

I ran into the same problem. It's easily solved by going into the Network Admin > Settings page. Look for the label "Add New Users" and make sure this option is checked: Allow site administrators to add new users to their site via the "Users → Add New" page.

Once you do this, the local admin will be able to add users. This is assuming they also have the capabilities 'list_users' and 'create_users'. I recommend this full list of related user capabilities be given: list_users create_users promote_users edit_users remove_users delete_users

1

According to the Codex article on Roles and Capabilities, the Administrator of any site within Multisite would have the ability to create users.

With that said, why not add users as Admins instead of creating a new role and adding capabilities?

  • Thanks for the reply. It looks like capabilities.php has the following line elseif ( is_super_admin( $user_id ) || get_site_option( 'add_new_users' ) ) which is causing my issue. I'll be having a looking further into getting get_site_option( 'add_new_users' ) to return true. – sjhuda Oct 14 '16 at 14:39
  • 1
    Bear in mind that, in Multisite, any user created is created in the network, not in the individual site. Which is why (I assume) the creation of users is assigned to Super Admins in Multisite. – Pat J Oct 15 '16 at 3:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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