W3cubDocs

/WordPress

get_users_of_blog( int $id = '' )

This function has been deprecated. Use get_users() instead.

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;
}

Changelog

Version Description
3.1.0 Use get_users()
2.2.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_users_of_blog