WordPress.org

Make WordPress Core

Ticket #16702: 16702.3.patch

File 16702.3.patch, 670 bytes (added by SergeyBiryukov, 2 years ago)
  • wp-includes/user.php

     
    730730function is_blog_user( $blog_id = 0 ) { 
    731731        global $wpdb; 
    732732 
    733         $current_user = wp_get_current_user(); 
    734733        if ( !$blog_id ) 
    735734                $blog_id = $wpdb->blogid; 
    736735 
    737         $cap_key = $wpdb->base_prefix . $blog_id . '_capabilities'; 
     736        $blogs = get_blogs_of_user( get_current_user_id() ); 
    738737 
    739         if ( is_array($current_user->$cap_key) && in_array(1, $current_user->$cap_key) ) 
    740                 return true; 
    741  
    742         return false; 
     738        return is_array( $blogs ) && array_key_exists( $blog_id, $blogs ); 
    743739} 
    744740 
    745741/**