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.

Top ↑

See also


Top ↑

Parameters

$id

(int)(Optional)Site ID.

Default value: ''


Top ↑

Return

(array) List of users that are part of that site ID


Top ↑

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


Top ↑

Changelog

Changelog
VersionDescription
3.1.0Use get_users()
2.2.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More