is_user_member_of_blog

Definition:
function is_user_member_of_blog( $user_id = 0, $blog_id = 0 ) {}

Find out whether a user is a member of a given blog.

Parameters

  • int $user_id: The unique ID of the user
  • int $blog: Optional. If no blog_id is provided, current site is used
  • $blog_id

Source code

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

	if ( is_array( $blogs ) )

		return array_key_exists( $blog_id, $blogs );

	else

		return false;

}

16682

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: