Changeset 65160
- Timestamp:
- 11/01/2026 03:10:29 AM (8 hours ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
src/wp-admin/includes/class-wp-ms-sites-list-table.php (modified) (6 diffs)
-
src/wp-admin/includes/class-wp-ms-users-list-table.php (modified) (3 diffs)
-
src/wp-admin/network/sites.php (modified) (1 diff)
-
src/wp-admin/network/users.php (modified) (1 diff)
-
tests/phpunit/tests/multisite/wpMsSitesListTable.php (modified) (1 diff)
-
tests/phpunit/tests/multisite/wpMsUsersListTable.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-ms-sites-list-table.php
r64222 r65160 66 66 * @since 3.1.0 67 67 * 68 * @global string $mode List table view mode.69 68 * @global string $s Search string. 70 69 * @global wpdb $wpdb WordPress database abstraction object. 71 70 */ 72 71 public function prepare_items() { 73 global $mode, $s, $wpdb; 74 75 if ( ! empty( $_REQUEST['mode'] ) ) { 76 $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; 77 set_user_setting( 'sites_list_mode', $mode ); 78 } else { 79 $mode = get_user_setting( 'sites_list_mode', 'list' ); 80 } 72 global $s, $wpdb; 81 73 82 74 $per_page = $this->get_items_per_page( 'sites_network_per_page' ); … … 312 304 313 305 /** 314 * Displays the pagination.315 *316 * @since 3.1.0317 *318 * @global string $mode List table view mode.319 *320 * @param string $which The location of the pagination nav markup: Either 'top' or 'bottom'.321 *322 * @phpstan-param 'top'|'bottom' $which323 */324 protected function pagination( $which ) {325 global $mode;326 327 parent::pagination( $which );328 329 if ( 'top' === $which ) {330 $this->view_switcher( $mode );331 }332 }333 334 /**335 306 * Displays extra controls between bulk actions and pagination. 336 307 * … … 475 446 * @since 4.3.0 476 447 * 477 * @global string $mode List table view mode.478 *479 448 * @param array $blog Current site. 480 449 */ 481 450 public function column_blogname( $blog ) { 482 global $mode;483 484 451 $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); 485 452 … … 497 464 </strong> 498 465 <?php 499 if ( 'list' !== $mode ) {500 switch_to_blog( $blog['blog_id'] );501 echo '<p>';502 printf(503 /* translators: 1: Site title, 2: Site tagline. */504 __( '%1$s – %2$s' ),505 get_option( 'blogname' ),506 '<em>' . get_option( 'blogdescription' ) . '</em>'507 );508 echo '</p>';509 restore_current_blog();510 }511 466 } 512 467 … … 516 471 * @since 4.3.0 517 472 * 518 * @global string $mode List table view mode.519 *520 473 * @param array $blog Current site. 521 474 */ 522 475 public function column_lastupdated( $blog ) { 523 global $mode; 524 525 if ( 'list' === $mode ) { 526 $date = __( 'Y/m/d' ); 527 } else { 528 $date = __( 'Y/m/d g:i:s a' ); 529 } 476 $date = __( 'Y/m/d g:i:s a' ); 530 477 531 478 if ( '0000-00-00 00:00:00' === $blog['last_updated'] ) { … … 541 488 * @since 4.3.0 542 489 * 543 * @global string $mode List table view mode.544 *545 490 * @param array $blog Current site. 546 491 */ 547 492 public function column_registered( $blog ) { 548 global $mode; 549 550 if ( 'list' === $mode ) { 551 $date = __( 'Y/m/d' ); 552 } else { 553 $date = __( 'Y/m/d g:i:s a' ); 554 } 493 $date = __( 'Y/m/d g:i:s a' ); 555 494 556 495 if ( '0000-00-00 00:00:00' === $blog['registered'] ) { -
trunk/src/wp-admin/includes/class-wp-ms-users-list-table.php
r64873 r65160 32 32 * @since 3.1.0 33 33 * 34 * @global string $mode List table view mode.35 34 * @global string $usersearch User search query. 36 35 * @global string $role The user role to filter by. Only 'super' (super admins) is supported. 37 36 */ 38 37 public function prepare_items() { 39 global $mode, $usersearch, $role; 40 41 if ( ! empty( $_REQUEST['mode'] ) ) { 42 $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; 43 set_user_setting( 'network_users_list_mode', $mode ); 44 } else { 45 $mode = get_user_setting( 'network_users_list_mode', 'list' ); 46 } 38 global $usersearch, $role; 47 39 48 40 $usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : ''; … … 188 180 189 181 return $this->get_views_links( $role_links ); 190 }191 192 /**193 * Generates the list table pagination.194 *195 * @since 3.1.0196 *197 * @global string $mode List table view mode.198 *199 * @param string $which The location of the pagination: Either 'top' or 'bottom'.200 *201 * @phpstan-param 'top'|'bottom' $which202 */203 protected function pagination( $which ) {204 global $mode;205 206 parent::pagination( $which );207 208 if ( 'top' === $which ) {209 $this->view_switcher( $mode );210 }211 182 } 212 183 … … 371 342 * @since 4.3.0 372 343 * 373 * @global string $mode List table view mode.374 *375 344 * @param WP_User $user The current WP_User object. 376 345 */ 377 346 public function column_registered( $user ) { 378 global $mode; 379 if ( 'list' === $mode ) { 380 $date = __( 'Y/m/d' ); 381 } else { 382 $date = __( 'Y/m/d g:i:s a' ); 383 } 384 echo mysql2date( $date, $user->user_registered ); 347 echo mysql2date( __( 'Y/m/d g:i:s a' ), $user->user_registered ); 385 348 } 386 349 -
trunk/src/wp-admin/network/sites.php
r61303 r65160 30 30 'content' => 31 31 '<p>' . __( 'Add Site takes you to the screen for adding a new site to the network. You can search for a site by Name, ID number, or IP address. Screen Options allows you to choose how many sites to display on one page.' ) . '</p>' . 32 '<p>' . __( 'This is the main table of all sites on this network. Switch between list and excerpt views by using the icons above the right side of the table.' ) . '</p>' .32 '<p>' . __( 'This is the main table of all sites on this network.' ) . '</p>' . 33 33 '<p>' . __( 'Hovering over each site reveals seven options (three for the primary site):' ) . '</p>' . 34 34 '<ul><li>' . __( 'An Edit link to a separate Edit Site screen.' ) . '</li>' . -
trunk/src/wp-admin/network/users.php
r62930 r65160 287 287 '<p>' . __( 'Hover over any user on the list to make the edit links appear. The Edit link on the left will take you to their Edit User profile page; the Edit link on the right by any site name goes to an Edit Site screen for that site.' ) . '</p>' . 288 288 '<p>' . __( 'You can also go to the user’s profile page by clicking on the individual username.' ) . '</p>' . 289 '<p>' . __( 'You can sort the table by clicking on any of the table headings and switch between list and excerpt views by using the icons above the users list.' ) . '</p>' .289 '<p>' . __( 'You can sort the table by clicking on any of the table headings.' ) . '</p>' . 290 290 '<p>' . __( 'The bulk action will permanently delete selected users, or mark/unmark those selected as spam. Spam users will have posts removed and will be unable to sign up again with the same email addresses.' ) . '</p>' . 291 291 '<p>' . __( 'You can make an existing user an additional super admin by going to the Edit User profile page and checking the box to grant that privilege.' ) . '</p>', -
trunk/tests/phpunit/tests/multisite/wpMsSitesListTable.php
r60148 r65160 243 243 $this->assertSame( $expected, $this->table->get_views() ); 244 244 } 245 246 /** 247 * @ticket 43899 248 */ 249 public function test_view_switcher_is_not_displayed() { 250 $pagination = new ReflectionMethod( $this->table, 'pagination' ); 251 if ( PHP_VERSION_ID < 80100 ) { 252 $pagination->setAccessible( true ); 253 } 254 255 ob_start(); 256 $pagination->invoke( $this->table, 'top' ); 257 $output = ob_get_clean(); 258 259 $this->assertStringNotContainsString( 'view-switch', $output ); 260 } 261 262 /** 263 * @ticket 43899 264 */ 265 public function test_site_details_are_not_displayed_without_switching_blog() { 266 $_REQUEST['mode'] = 'excerpt'; 267 $this->table->prepare_items(); 268 unset( $_REQUEST['mode'] ); 269 270 $site_id = self::$site_ids['wordpress.org/foo/']; 271 update_blog_option( $site_id, 'blogname', 'Test site title' ); 272 update_blog_option( $site_id, 'blogdescription', 'Test site tagline' ); 273 274 $switch_blog = new MockAction(); 275 add_action( 'switch_blog', array( $switch_blog, 'action' ) ); 276 277 ob_start(); 278 $this->table->column_blogname( 279 array( 280 'blog_id' => $site_id, 281 'domain' => 'wordpress.org', 282 'path' => '/foo/', 283 ) 284 ); 285 $output = ob_get_clean(); 286 287 remove_action( 'switch_blog', array( $switch_blog, 'action' ) ); 288 289 $this->assertStringNotContainsString( 'Test site title', $output ); 290 $this->assertStringNotContainsString( 'Test site tagline', $output ); 291 $this->assertSame( 0, $switch_blog->get_call_count() ); 292 } 293 294 /** 295 * @ticket 43899 296 */ 297 public function test_list_mode_request_does_not_change_site_date_format() { 298 $_REQUEST['mode'] = 'list'; 299 $this->table->prepare_items(); 300 unset( $_REQUEST['mode'] ); 301 302 $date = '2025-01-02 03:04:05'; 303 $blog = array( 304 'last_updated' => $date, 305 'registered' => $date, 306 ); 307 308 ob_start(); 309 $this->table->column_lastupdated( $blog ); 310 $last_updated = ob_get_clean(); 311 312 ob_start(); 313 $this->table->column_registered( $blog ); 314 $registered = ob_get_clean(); 315 316 $expected = mysql2date( __( 'Y/m/d g:i:s a' ), $date ); 317 $this->assertSame( $expected, $last_updated ); 318 $this->assertSame( $expected, $registered ); 319 } 245 320 } -
trunk/tests/phpunit/tests/multisite/wpMsUsersListTable.php
r60148 r65160 105 105 $this->assertSame( $expected, $this->table->get_views() ); 106 106 } 107 108 /** 109 * @ticket 43899 110 */ 111 public function test_view_switcher_is_not_displayed() { 112 $pagination = new ReflectionMethod( $this->table, 'pagination' ); 113 if ( PHP_VERSION_ID < 80100 ) { 114 $pagination->setAccessible( true ); 115 } 116 117 ob_start(); 118 $pagination->invoke( $this->table, 'top' ); 119 $output = ob_get_clean(); 120 121 $this->assertStringNotContainsString( 'view-switch', $output ); 122 } 123 124 /** 125 * @ticket 43899 126 */ 127 public function test_list_mode_request_does_not_change_registered_date_format() { 128 $_REQUEST['mode'] = 'list'; 129 $this->table->prepare_items(); 130 unset( $_REQUEST['mode'] ); 131 132 $user = new WP_User(); 133 $user->user_registered = '2025-01-02 03:04:05'; 134 135 ob_start(); 136 $this->table->column_registered( $user ); 137 $output = ob_get_clean(); 138 139 $this->assertSame( mysql2date( __( 'Y/m/d g:i:s a' ), $user->user_registered ), $output ); 140 } 107 141 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)