get_admin_users_for_domain

Get the admin for a domain/path combination.

Description

(array|false) get_admin_users_for_domain( (string) $sitedomain = '', (string) $path = '' ); 

Returns (array|false)

The network admins

Parameters (2)

0. $sitedomain — Optional. (string) => ''
Site domain.
1. $path — Optional. (string) => ''
Site path.

Usage

  1. if ( !function_exists( 'get_admin_users_for_domain' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-deprecated.php'; 
  3.  
  4. // Optional. Site domain. 
  5. $sitedomain = ''; 
  6.  
  7. // Optional. Site path. 
  8. $path = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = get_admin_users_for_domain($sitedomain, $path); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/ms-deprecated.php  
  1. function get_admin_users_for_domain( $sitedomain = '', $path = '' ) { 
  2. _deprecated_function( __FUNCTION__, '4.4.0' ); 
  3.  
  4. global $wpdb; 
  5.  
  6. if ( ! $sitedomain ) 
  7. $site_id = $wpdb->siteid; 
  8. else 
  9. $site_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path ) ); 
  10.  
  11. if ( $site_id ) 
  12. 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", $site_id ), ARRAY_A ); 
  13.  
  14. return false;