1

I have seen similar questions however the one I found asking a question close to this was never answered.

I am attempting to create a role for our support team on our MultiSite install where they can access all sites like a super-admin can, as well as manage/create/edit/delete users and sites across the network.

According to the Codes on capabilities the manage_sites and manage_network_users should grant these options, or am I not reading correctly? The code for my plugin so far is here:

function sqms_add_custom_roles() {
add_role(
    'sqms_support_team',
    __( 'Support Team' ),
    array(
        'delete_others_pages'    => true,
        'delete_others_posts'    => true,
        'delete_pages'           => true,
        'delete_posts'           => true,
        'delete_private_pages'   => true,
        'delete_private_posts'   => true,
        'delete_published_pages' => true,
        'delete_published_posts' => true,
        'edit_dashboard'         => true,
        'edit_files'             => true,
        'edit_others_pages'      => true,
        'edit_others_posts'      => true,
        'edit_pages'             => true,
        'edit_posts'             => true,
        'edit_private_pages'     => true,
        'edit_private_posts'     => true,
        'edit_published_pages'   => true,
        'edit_published_posts'   => true,
        'edit_theme_options'     => true,
        'export'                 => true,
        'import'                 => true,
        'list_users'             => true,
        'manage_categories'      => true,
        'manage_links'           => true,
        'manage_options'         => true,
        'moderate_comments'      => true,
        'promote_users'          => true,
        'publish_pages'          => true,
        'publish_posts'          => true,
        'read_private_pages'     => true,
        'read_private_posts'     => true,
        'read'                   => true,
        'remove_users'           => true,
        'switch_themes'          => true,
        'upload_files'           => true,
        'edit_users'             => true,
        'create_users'           => true,
        'delete_users'           => true,
        'unfiltered_html'        => true,
        'manage_sites'           => true,
        'manage_network_users'   => true,
    )
);

}

function sqms_remove_custom_roles() {
    remove_role( 'sqms_support_team' );
}

register_activation_hook( __FILE__, 'sqms_add_custom_roles' );
register_deactivation_hook( __FILE__, 'sqms_remove_custom_roles' );

The "network" option does not show up in the "my sites" menu, and navigating to /site-new.php just give a no permissions error.

Any advice? Thank you.

2

According to the Codes on capabilities the manage_sites and manage_network_users should grant these options, or am I not reading correctly?

Apparently, the capabilities here are not enough. Check out wp-admin/network.php. You'll see it dies if the current user fails the is_super_admin check. This check gets the $super_admins global from get_super_admins and returns false if the current user is not in that array. It appears a user HAS to be added as a super admin via that option, not just via the appropriate capabilities. That option can be set by manually editing a user (there is a checkbox for it on the user edit screen), or by using the grant_super_admin function.

Regarding the admin bar showing what you want, check out wp-includes/admin-bar.php. You'll see it also runs the is_super_admin check to determine the output of the Network Admin menu.

  • Ahh thank you Josh. That makes sense why it wasn't working, I was hoping to find a way to give extra abilities without making them super admins, so I will keep exploring. – thatryan Sep 29 '14 at 19:13

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.