diff --git wp-admin/includes/class-wp-ms-sites-list-table.php wp-admin/includes/class-wp-ms-sites-list-table.php
index 9ce3ffe..113f238 100644
|
|
class WP_MS_Sites_List_Table extends WP_List_Table { |
388 | 388 | * Handles the users column output. |
389 | 389 | * |
390 | 390 | * @since 4.3.0 |
| 391 | * @since 4.7.0 Display First user of the site, and number of users in the site |
391 | 392 | * @access public |
392 | 393 | * |
393 | 394 | * @param array $blog Current site. |
394 | 395 | */ |
395 | 396 | public function column_users( $blog ) { |
| 397 | global $mode; |
| 398 | |
| 399 | $blog_users = get_users( array( |
| 400 | 'blog_id' => $blog['blog_id'], |
| 401 | 'orderby' => 'registered', |
| 402 | ) ); |
| 403 | |
396 | 404 | $user_count = wp_cache_get( $blog['blog_id'] . '_user_count', 'blog-details' ); |
397 | 405 | if ( ! $user_count ) { |
398 | | $blog_users = get_users( array( 'blog_id' => $blog['blog_id'], 'fields' => 'ID' ) ); |
399 | 406 | $user_count = count( $blog_users ); |
400 | | unset( $blog_users ); |
401 | 407 | wp_cache_set( $blog['blog_id'] . '_user_count', $user_count, 'blog-details', 12 * HOUR_IN_SECONDS ); |
402 | 408 | } |
403 | 409 | |
404 | 410 | printf( |
405 | 411 | '<a href="%s">%s</a>', |
406 | | esc_url( network_admin_url( 'site-users.php?id=' . $blog['blog_id'] ) ), |
407 | | number_format_i18n( $user_count ) |
| 412 | esc_url( network_admin_url( 'user-edit.php?user_id=' . $blog_users[0]->ID ) ), |
| 413 | $blog_users[0]->user_login |
408 | 414 | ); |
| 415 | |
| 416 | if ( $user_count > 1 ) { |
| 417 | if ( 'excerpt' === $mode) { |
| 418 | foreach ( $blog_users as $key => $user ) { |
| 419 | // Don't display again the first user |
| 420 | if ( 0 === $key ) { |
| 421 | continue; |
| 422 | } |
| 423 | |
| 424 | printf( |
| 425 | '</br><a href="%s">%s</a>', |
| 426 | esc_url( network_admin_url( 'user-edit.php?user_id=' . $user->ID ) ), |
| 427 | $user->user_login |
| 428 | ); |
| 429 | |
| 430 | // Only display 10 first users |
| 431 | if ( $user_count > 10 && 9 === $key ) { |
| 432 | printf( '</br><a href="%s">%s</a>', |
| 433 | esc_url( network_admin_url( 'site-users.php?id=' . $blog['blog_id'] ) ), |
| 434 | sprintf( |
| 435 | _x( '+ %s more users', 'Number of users of a site of a network (in admin page : wp-admin/network/sites.php)' ), |
| 436 | number_format_i18n( $user_count -10 ) |
| 437 | ) |
| 438 | ); |
| 439 | break; |
| 440 | } |
| 441 | } |
| 442 | } else { |
| 443 | printf( '</br><a href="%s">%s</a>', |
| 444 | esc_url( network_admin_url( 'site-users.php?id=' . $blog['blog_id'] ) ), |
| 445 | sprintf( |
| 446 | _x( '+ %s more users', 'Number of users of a site of a network (in admin page : wp-admin/network/sites.php)' ), |
| 447 | number_format_i18n( $user_count -1 ) |
| 448 | ) |
| 449 | ); |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | unset( $blog_users ); |
409 | 454 | } |
410 | 455 | |
411 | 456 | /** |