is_user_member_of_blog()
is_user_member_of_blog( int $user_id, int $blog_id ) 找出…
is_user_member_of_blog( int $user_id, int $blog_id )
找出用户是否是给定博客的成员。
Find out whether a user is a member of a given blog.
找出用户是否是给定博客的成员。
Find out whether a user is a member of a given blog.
目录锚点:#参数#返回#源码#笔记
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| $user_id | (int) | 可选 | 用户的唯一ID。默认为当前用户。 |
| $blog_id | (int) | 可选 | 要检查的博客的ID。默认为当前网站。 |
返回(Return)
(bool)
源码(Source)
/**
* Find out whether a user is a member of a given blog.
*
* @since MU 1.1
*
* @param int $user_id Optional. The unique ID of the user. Defaults to the current user.
* @param int $blog_id Optional. ID of the blog to check. Defaults to the current site.
* @return bool
*/
function is_user_member_of_blog( $user_id = 0, $blog_id = 0 ) {
$user_id = (int) $user_id;
$blog_id = (int) $blog_id;
if ( empty( $user_id ) )
$user_id = get_current_user_id();
if ( empty( $blog_id ) )
$blog_id = get_current_blog_id();
$blogs = get_blogs_of_user( $user_id );
return array_key_exists( $blog_id, $blogs );
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| MU (3.0.0) | wp-includes/user.php:727 | 6 | 6 |
笔记(Notes)
检查用户是否是博客的成员
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。





还没有任何评论,赶紧来占个楼吧!