function is_blog_user( $blog_id = 0 ) {}

Checks if the current user belong to a given blog.


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



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: Logo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: