Turn is_blog_user() into a convenience wrapper around get_blogs_of_user(). Fixes is_blog_user() for blog prefixes that do not contain a blog ID. Props SergeyBiryukov. fixes #16702

git-svn-id: http://svn.automattic.com/wordpress/trunk@19004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2011-10-19 15:53:14 +00:00
parent 9bfad4c43e
commit 9d8e281a80
1 changed files with 3 additions and 7 deletions

View File

@ -730,16 +730,12 @@ function get_blogs_of_user( $user_id, $all = false ) {
function is_blog_user( $blog_id = 0 ) {
global $wpdb;
$current_user = wp_get_current_user();
if ( !$blog_id )
if ( ! $blog_id )
$blog_id = $wpdb->blogid;
$cap_key = $wpdb->base_prefix . $blog_id . '_capabilities';
$blogs = get_blogs_of_user( get_current_user_id() );
if ( is_array($current_user->$cap_key) && in_array(1, $current_user->$cap_key) )
return true;
return false;
return is_array( $blogs ) && array_key_exists( $blog_id, $blogs );
}
/**