WordPress.org

Make WordPress Core

Changeset 19004


Ignore:
Timestamp:
10/19/2011 03:53:14 PM (7 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/user.php

    r18936 r19004  
    731731    global $wpdb;
    732732
    733     $current_user = wp_get_current_user();
    734     if ( !$blog_id )
     733    if ( ! $blog_id )
    735734        $blog_id = $wpdb->blogid;
    736735
    737     $cap_key = $wpdb->base_prefix . $blog_id . '_capabilities';
    738 
    739     if ( is_array($current_user->$cap_key) && in_array(1, $current_user->$cap_key) )
    740         return true;
    741 
    742     return false;
     736    $blogs = get_blogs_of_user( get_current_user_id() );
     737
     738    return is_array( $blogs ) && array_key_exists( $blog_id, $blogs );
    743739}
    744740
Note: See TracChangeset for help on using the changeset viewer.