get_users_of_blog() - WordPress 函数参考中文文档

返回介绍

get_users_of_blog()

发布于 2017-09-11 字数1865 浏览 980 评论 0

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

get_users_of_blog( int $id = '' )

Get users for the site.


描述

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


参数

$id

(int)
(Optional)
Site ID.

Default value: ”


返回值

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


源代码

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

更新日志

Version 描述
3.1.0 Use get_users()
2.2.0 Introduced.

相关函数

Uses

  • wp-includes/load.php:
    get_current_blog_id()
  • wp-includes/functions.php:
    _deprecated_function()
  • wp-includes/wp-db.php:
    wpdb::get_results()
  • wp-includes/wp-db.php:
    wpdb::get_blog_prefix()

User Contributed Notes

上一篇:get_users_drafts()

下一篇:get_user_by()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!