Warning: This function has been deprecated. Use get_users() instead.
get_users_of_blog() WordPress Function
The get_users_of_blog() function in WordPress allows you to get a list of users who are associated with a particular blog. This can be useful if you want to display a list of users on a blog or allow users to select a blog from a list of blogs they are associated with.
get_users_of_blog( int $id = '' ) #
Get users for the site.
Description
For setups that use the multisite feature. Can be used outside of the multisite feature.
See also
Parameters
- $id
(int)(Optional)Site ID.
Default value: ''
Return
(array) List of users that are part of that site ID
Source
File: 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;
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Use get_users() |
| 2.2.0 | Introduced. |