$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>multisite - Site admin in a network install can't edit users?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

multisite - Site admin in a network install can't edit users?

matteradmin7PV0评论

For the Stack Exchange Community Blogs, we have a network install that we've set up. I am being told that the site administrator role is not allowing an option for user editing. On the site's users page when hovering over a user, there is only an option for delete, not one for edit.

The only option related to user permissions is the following, but not really what I'm going for here...

How can I enable the site administrator to have full control over the users on that specific site?

For the Stack Exchange Community Blogs, we have a network install that we've set up. I am being told that the site administrator role is not allowing an option for user editing. On the site's users page when hovering over a user, there is only an option for delete, not one for edit.

The only option related to user permissions is the following, but not really what I'm going for here...

How can I enable the site administrator to have full control over the users on that specific site?

Share Improve this question asked May 17, 2011 at 17:40 Rebecca ChernoffRebecca Chernoff 3151 gold badge4 silver badges12 bronze badges
Add a comment  | 

5 Answers 5

Reset to default 10

As explained in the description of the Network Admin Users screen, in a network install (multisite mode) users are

added on a global basis to the entire network, then assigned to specific sites

Normal administrators are not permitted to modify these global profiles, since their privileges extend only to their given site. This task is reserved for super administrators, who have full control across the entire network.

In prior versions of WordPress, when multisite installations relied on separate WordPress MU support, you could define EDIT_ANY_USER to be true in your wp-config.php file. However, since multisite support was natively integrated, I believe that this was removed.

To manage network users from the Network Admin Users screen, a user must belong to a role that has at least the manage_network_users and edit_users permissions. You could try creating a custom role that included these and the standard administrator permissions, but I'm not convinced how effective that would be. Personally, I'd just try to avoid circumventing these restrictions.

This worked for me: http://thereforei.am/2011/03/15/how-to-allow-administrators-to-edit-users-in-a-wordpress-network/

Wordpress multisite 3.0 doesn't allow site admins to edit users. http://wordpress/support/topic/administrators-cant-edit-users

Perhaps this plugin can help: http://wordpress/extend/plugins/extended-super-admins/ in combination with hard-coding the global variable, $super_admins, specific to each site.

It should be able to be set in a hook as the site admin menu is loaded -- not quite sure how to enforce that yet. It seems a promising solution to an issue I'll have to deal with myself, shortly.

See: http://svn.automattic/wordpress/trunk/wp-admin/includes/ms.php and note the return if the global, $super_admins is already set.

/**
 * Grants super admin privileges.
 *
 * @since 3.0.0
 * @param int $user_id
 */
function grant_super_admin( $user_id ) {
    global $super_admins;

    // If global super_admins override is defined, there is nothing to do here.
    if ( isset($super_admins) )
        return false;

    do_action( 'grant_super_admin', $user_id );

    // Directly fetch site_admins instead of using get_super_admins()
    $super_admins = get_site_option( 'site_admins', array( 'admin' ) );

    $user = new WP_User( $user_id );
    if ( ! in_array( $user->user_login, $super_admins ) ) {
        $super_admins[] = $user->user_login;
        update_site_option( 'site_admins' , $super_admins );
        do_action( 'granted_super_admin', $user_id );
        return true;
    }
    return false;
}

/**
 * Revokes super admin privileges.
 *
 * @since 3.0.0
 * @param int $user_id
 */
function revoke_super_admin( $user_id ) {
    global $super_admins;

    // If global super_admins override is defined, there is nothing to do here.
    if ( isset($super_admins) )
        return false;

    do_action( 'revoke_super_admin', $user_id );

    // Directly fetch site_admins instead of using get_super_admins()
    $super_admins = get_site_option( 'site_admins', array( 'admin' ) );

    $user = new WP_User( $user_id );
    if ( $user->user_email != get_site_option( 'admin_email' ) ) {
        if ( false !== ( $key = array_search( $user->user_login, $super_admins ) ) ) {
            unset( $super_admins[$key] );
            update_site_option( 'site_admins', $super_admins );
            do_action( 'revoked_super_admin', $user_id );
            return true;
        }
    }
    return false;
}

If you go to "Network Settings" as the super admin, you will see an option

Add New User: Allow site administrators to add new users to their site via the "Users → Add New" page

Simply check this option.

That will allow normal non-super sub-site administrators to add new users.

Post a comment

comment list (0)

  1. No comments so far