WordPress.org

Make WordPress Core

Changeset 41664


Ignore:
Timestamp:
10/02/2017 03:05:47 AM (2 years ago)
Author:
jeremyfelt
Message:

Multisite: Use get_networks() instead of a direct query in get_admin_users_for_domain().

Props spacedmonkey.
Fixes #41806.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-deprecated.php

    r41289 r41664  
    430430    global $wpdb;
    431431
    432     if ( ! $domain )
     432    if ( ! $domain ) {
    433433        $network_id = get_current_network_id();
    434     else
    435         $network_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path ) );
     434    } else {
     435        $_networks  = get_networks( array(
     436            'fields' => 'ids',
     437            'number' => 1,
     438            'domain' => $domain,
     439            'path'   => $path,
     440        ) );
     441        $network_id = ! empty( $_networks ) ? array_shift( $_networks ) : 0;
     442    }
    436443
    437444    if ( $network_id )
Note: See TracChangeset for help on using the changeset viewer.