Changeset 41653
- Timestamp:
- 09/30/2017 03:53:27 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/user.php
r41564 r41653 856 856 857 857 if ( 'time' == $strategy ) { 858 $avail_roles = wp_roles()->get_names(); 858 if ( is_multisite() && $site_id != get_current_blog_id() ) { 859 switch_to_blog( $site_id ); 860 $avail_roles = wp_roles()->get_names(); 861 restore_current_blog(); 862 } else { 863 $avail_roles = wp_roles()->get_names(); 864 } 859 865 860 866 // Build a CPU-intensive query that will return concise information. -
trunk/tests/phpunit/tests/user/countUsers.php
r41138 r41653 132 132 ), $count['avail_roles'] ); 133 133 134 } 135 136 /** 137 * @ticket 42014 138 * @group multisite 139 * @group ms-required 140 * 141 * @dataProvider data_count_users_strategies 142 */ 143 public function test_count_users_multisite_queries_correct_roles( $strategy ) { 144 $site_id = (int) self::factory()->blog->create(); 145 146 switch_to_blog( $site_id ); 147 wp_roles()->add_role( 'tester', 'Tester', array( 'test' => true ) ); 148 $user_id = self::factory()->user->create( array( 149 'role' => 'tester', 150 ) ); 151 restore_current_blog(); 152 153 $count = count_users( $strategy, $site_id ); 154 $this->assertEqualSetsWithIndex( array( 155 'tester' => 1, 156 'none' => 0, 157 ), $count['avail_roles'] ); 134 158 } 135 159
Note: See TracChangeset
for help on using the changeset viewer.