Quantcast
Channel: A HitchHackers guide through WordPress » Functions by letter i
Viewing all articles
Browse latest Browse all 10

is_user_member_of_blog

$
0
0

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


Filed under: /wp-includes/user.php, Documentation, Files, Functions, Functions by letter i Tagged: codex, idb530dafb5e0e64dc151de2228c6ade97, is_user_member_of_blog

Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images