From 9d8e281a8033c73eb06319d2a2589031d69bc3f6 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 19 Oct 2011 15:53:14 +0000 Subject: [PATCH] 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 --- wp-includes/user.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/wp-includes/user.php b/wp-includes/user.php index d2261e59b..6410f87c3 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -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 ); } /**