Ticket #37061: 37061.diff
File 37061.diff, 3.6 KB (added by , 8 years ago) |
---|
-
src/wp-includes/class-wp-site.php
17 17 * 18 18 * @property int $id 19 19 * @property int $network_id 20 * @property int $userblog_id 20 21 */ 21 22 final class WP_Site { 22 23 … … 229 230 public function __get( $key ) { 230 231 switch ( $key ) { 231 232 case 'id': 233 case 'userblog_id': 232 234 return (int) $this->blog_id; 233 235 case 'network_id': 234 236 return (int) $this->site_id; … … 261 263 public function __isset( $key ) { 262 264 switch ( $key ) { 263 265 case 'id': 266 case 'userblog_id': 264 267 case 'network_id': 265 268 return true; 266 269 case 'blogname': … … 290 293 public function __set( $key, $value ) { 291 294 switch ( $key ) { 292 295 case 'id': 296 case 'userblog_id': 293 297 $this->blog_id = (string) $value; 294 298 break; 295 299 case 'network_id': -
src/wp-includes/user.php
618 618 return $blogs; 619 619 } 620 620 621 $ blogs = array();621 $site_ids = array(); 622 622 623 623 if ( isset( $keys[ $wpdb->base_prefix . 'capabilities' ] ) && defined( 'MULTISITE' ) ) { 624 $blog = get_blog_details( 1 ); 625 if ( $blog && isset( $blog->domain ) && ( $all || ( ! $blog->archived && ! $blog->spam && ! $blog->deleted ) ) ) { 626 $blogs[ 1 ] = (object) array( 627 'userblog_id' => 1, 628 'blogname' => $blog->blogname, 629 'domain' => $blog->domain, 630 'path' => $blog->path, 631 'site_id' => $blog->site_id, 632 'siteurl' => $blog->siteurl, 633 'archived' => $blog->archived, 634 'mature' => $blog->mature, 635 'spam' => $blog->spam, 636 'deleted' => $blog->deleted, 637 ); 638 } 624 $site_ids[] = 1; 639 625 unset( $keys[ $wpdb->base_prefix . 'capabilities' ] ); 640 626 } 641 627 … … 650 636 if ( ! is_numeric( $blog_id ) ) 651 637 continue; 652 638 653 $blog_id = (int) $blog_id; 654 $blog = get_blog_details( $blog_id ); 655 if ( $blog && isset( $blog->domain ) && ( $all || ( ! $blog->archived && ! $blog->spam && ! $blog->deleted ) ) ) { 656 $blogs[ $blog_id ] = (object) array( 657 'userblog_id' => $blog_id, 658 'blogname' => $blog->blogname, 659 'domain' => $blog->domain, 660 'path' => $blog->path, 661 'site_id' => $blog->site_id, 662 'siteurl' => $blog->siteurl, 663 'archived' => $blog->archived, 664 'mature' => $blog->mature, 665 'spam' => $blog->spam, 666 'deleted' => $blog->deleted, 667 ); 668 } 639 $site_ids[] = (int) $blog_id; 669 640 } 670 641 642 $args = array( 643 'number' => '', 644 'site__in' => $site_ids, 645 ); 646 if ( ! $all ) { 647 $args['archived'] = 0; 648 $args['spam'] = 0; 649 $args['deleted'] = 0; 650 } 651 652 $_sites = get_sites( $args ); 653 654 $sites = array(); 655 foreach ( $_sites as $site ) { 656 $sites[ $site->id ] = $site; 657 } 658 671 659 /** 672 * Filters the list of blogs a user belongs to.660 * Filters the list of sites a user belongs to. 673 661 * 674 662 * @since MU 675 663 * 676 * @param array $ blogs An array of blogobjects belonging to the user.664 * @param array $sites An array of site objects belonging to the user. 677 665 * @param int $user_id User ID. 678 * @param bool $all Whether the returned blogs array should contain all blogs, including666 * @param bool $all Whether the returned sites array should contain all sites, including 679 667 * those marked 'deleted', 'archived', or 'spam'. Default false. 680 668 */ 681 return apply_filters( 'get_blogs_of_user', $ blogs, $user_id, $all );669 return apply_filters( 'get_blogs_of_user', $sites, $user_id, $all ); 682 670 } 683 671 684 672 /**