diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php
index 69b8c35208..73a7e8db92 100644
|
a
|
b
|
function get_blogs_of_user( $user_id, $all = false ) {
|
| 643 | 643 | $sites[ $site_id ]->path = ''; |
| 644 | 644 | $sites[ $site_id ]->site_id = 1; |
| 645 | 645 | $sites[ $site_id ]->siteurl = get_option( 'siteurl' ); |
| | 646 | $sites[ $site_id ]->public = get_option( 'blog_public' ); |
| 646 | 647 | $sites[ $site_id ]->archived = 0; |
| | 648 | $sites[ $site_id ]->mature = 0; |
| 647 | 649 | $sites[ $site_id ]->spam = 0; |
| 648 | 650 | $sites[ $site_id ]->deleted = 0; |
| 649 | 651 | return $sites; |
| … |
… |
function get_blogs_of_user( $user_id, $all = false ) {
|
| 697 | 699 | 'path' => $site->path, |
| 698 | 700 | 'site_id' => $site->network_id, |
| 699 | 701 | 'siteurl' => $site->siteurl, |
| | 702 | 'public' => $site->public, |
| 700 | 703 | 'archived' => $site->archived, |
| 701 | 704 | 'mature' => $site->mature, |
| 702 | 705 | 'spam' => $site->spam, |
diff --git a/tests/phpunit/tests/user/multisite.php b/tests/phpunit/tests/user/multisite.php
index 01c7b7d096..083e718b17 100644
|
a
|
b
|
if ( is_multisite() ) :
|
| 45 | 45 | $user1_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); |
| 46 | 46 | |
| 47 | 47 | // Maintain a list of 6 total sites and include the primary network site. |
| 48 | | $blog_ids = self::factory()->blog->create_many( 5, array( 'user_id' => $user1_id ) ); |
| | 48 | $blog_ids = self::factory()->blog->create_many( 6, array( 'user_id' => $user1_id ) ); |
| 49 | 49 | $blog_ids = array_merge( array( 1 ), $blog_ids ); |
| 50 | 50 | |
| 51 | 51 | // All sites are new and not marked as spam, archived, or deleted. |
| … |
… |
if ( is_multisite() ) :
|
| 78 | 78 | $this->assertTrue( isset( $blog->path ) ); |
| 79 | 79 | $this->assertTrue( isset( $blog->site_id ) ); |
| 80 | 80 | $this->assertTrue( isset( $blog->siteurl ) ); |
| | 81 | $this->assertTrue( isset( $blog->public ) ); |
| 81 | 82 | $this->assertTrue( isset( $blog->archived ) ); |
| 82 | 83 | $this->assertTrue( isset( $blog->spam ) ); |
| 83 | 84 | $this->assertTrue( isset( $blog->deleted ) ); |
| 84 | 85 | } |
| 85 | 86 | |
| 86 | | // Mark each remaining site as spam, archived, and deleted. |
| | 87 | // Mark each remaining site as spam, archived, deleted, and private. |
| 87 | 88 | update_blog_details( $blog_ids[0], array( 'spam' => 1 ) ); |
| 88 | 89 | update_blog_details( $blog_ids[1], array( 'archived' => 1 ) ); |
| 89 | 90 | update_blog_details( $blog_ids[2], array( 'deleted' => 1 ) ); |
| | 91 | update_blog_details( $blog_ids[3], array( 'public' => 0 ) ); |
| 90 | 92 | |
| 91 | 93 | // Passing true as the second parameter should retrieve ALL sites, even if marked. |
| 92 | 94 | $blogs_of_user = get_blogs_of_user( $user1_id, true ); |
| … |
… |
if ( is_multisite() ) :
|
| 97 | 99 | $this->assertEquals( 1, $blogs_of_user[ $blog_ids[0] ]->spam ); |
| 98 | 100 | $this->assertEquals( 1, $blogs_of_user[ $blog_ids[1] ]->archived ); |
| 99 | 101 | $this->assertEquals( 1, $blogs_of_user[ $blog_ids[2] ]->deleted ); |
| | 102 | $this->assertEquals( 0, $blogs_of_user[ $blog_ids[3] ]->public ); |
| 100 | 103 | |
| 101 | 104 | unset( $blog_ids[0] ); |
| 102 | 105 | unset( $blog_ids[1] ); |