get_users_of_blog

Get users for the site.

Description

(array) get_users_of_blog( (string) $id = '' ); 

For setups that use the multisite feature. Can be used outside of the multisite feature.

Returns (array)

List of users that are part of that site ID

Parameters (1)

0. $id — Optional. (string) => ''
Site ID.

Usage

  1. if ( !function_exists( 'get_users_of_blog' ) ) { 
  2. require_once ABSPATH . WPINC . '/deprecated.php'; 
  3.  
  4. // Site ID. 
  5. $id = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = get_users_of_blog($id); 
  9.  

Defined (1)

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

/wp-includes/deprecated.php  
  1. function get_users_of_blog( $id = '' ) { 
  2. _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); 
  3.  
  4. global $wpdb; 
  5. if ( empty( $id ) ) { 
  6. $blog_prefix = $wpdb->get_blog_prefix($id); 
  7. $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" ); 
  8. return $users;