is_blog_user

Definition:
function is_blog_user( $blog_id = 0 ) {}

Checks if the current user belong to a given blog.

Parameters

  • int $blog_id: Blog ID

Return values

returns:True if the current users belong to $blog_id, false if not.

Source code

function is_blog_user( $blog_id = 0 ) {

	global $wpdb;



	$current_user = wp_get_current_user();

	if ( !$blog_id )

		$blog_id = $wpdb->blogid;



	$cap_key = $wpdb->base_prefix . $blog_id . '_capabilities';



	if ( is_array($current_user->$cap_key) && in_array(1, $current_user->$cap_key) )

		return true;



	return false;

}

9868

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

Leave a comment