Multisite: Replace unnecessary is_super_admin()
check when setting up the initial network.
When using `is_super_admin()` in a non-multisite environment, the function is supposed to check for administrator capabilities. The process of querying all users and filtering them with that function can be optimized by only querying users with the administrator role instead. Fixes #40406. See #37616. git-svn-id: https://develop.svn.wordpress.org/trunk@40406 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
1b9c964e81
commit
78d7aba4ed
@ -951,12 +951,16 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam
|
||||
|
||||
if ( !is_multisite() ) {
|
||||
$site_admins = array( $site_user->user_login );
|
||||
$users = get_users( array( 'fields' => array( 'ID', 'user_login' ) ) );
|
||||
$users = get_users( array(
|
||||
'fields' => array( 'user_login' ),
|
||||
'role' => 'administrator',
|
||||
) );
|
||||
if ( $users ) {
|
||||
foreach ( $users as $user ) {
|
||||
if ( is_super_admin( $user->ID ) && !in_array( $user->user_login, $site_admins ) )
|
||||
$site_admins[] = $user->user_login;
|
||||
$site_admins[] = $user->user_login;
|
||||
}
|
||||
|
||||
$site_admins = array_unique( $site_admins );
|
||||
}
|
||||
} else {
|
||||
$site_admins = get_site_option( 'site_admins' );
|
||||
|
Loading…
Reference in New Issue
Block a user