Multisite: Use `get_networks()` instead of a direct query in `get_admin_users_for_domain()`.
Props spacedmonkey. Fixes #41806. Built from https://develop.svn.wordpress.org/trunk@41664 git-svn-id: http://core.svn.wordpress.org/trunk@41498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f0492c5da8
commit
b47cf7330c
|
@ -429,10 +429,17 @@ function get_admin_users_for_domain( $domain = '', $path = '' ) {
|
|||
|
||||
global $wpdb;
|
||||
|
||||
if ( ! $domain )
|
||||
if ( ! $domain ) {
|
||||
$network_id = get_current_network_id();
|
||||
else
|
||||
$network_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path ) );
|
||||
} else {
|
||||
$_networks = get_networks( array(
|
||||
'fields' => 'ids',
|
||||
'number' => 1,
|
||||
'domain' => $domain,
|
||||
'path' => $path,
|
||||
) );
|
||||
$network_id = ! empty( $_networks ) ? array_shift( $_networks ) : 0;
|
||||
}
|
||||
|
||||
if ( $network_id )
|
||||
return $wpdb->get_results( $wpdb->prepare( "SELECT u.ID, u.user_login, u.user_pass FROM $wpdb->users AS u, $wpdb->sitemeta AS sm WHERE sm.meta_key = 'admin_user_id' AND u.ID = sm.meta_value AND sm.site_id = %d", $network_id ), ARRAY_A );
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.9-alpha-41663';
|
||||
$wp_version = '4.9-alpha-41664';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue