From 85c931dc32171574b60918db16dff5605812b9fa Mon Sep 17 00:00:00 2001 From: Ryan Boren 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: https://develop.svn.wordpress.org/trunk@19004 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 d2261e59b1..6410f87c31 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 ); } /**