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
if ( !function_exists( 'get_users_of_blog' ) ) { require_once ABSPATH . WPINC . '/deprecated.php'; } // Site ID. $id = ''; // NOTICE! Understand what this does before running. $result = get_users_of_blog($id);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/deprecated.php
- function get_users_of_blog( $id = '' ) {
- _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
- global $wpdb;
- if ( empty( $id ) ) {
- $id = get_current_blog_id();
- }
- $blog_prefix = $wpdb->get_blog_prefix($id);
- $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" );
- return $users;
- }