- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-ms-users-list-table.php
r42257 r42343 18 18 class WP_MS_Users_List_Table extends WP_List_Table { 19 19 /** 20 *21 20 * @return bool 22 21 */ … … 26 25 27 26 /** 28 *29 27 * @global string $usersearch 30 28 * @global string $role … … 44 42 45 43 $args = array( 46 'number' => $users_per_page,47 'offset' => ( $paged-1 ) * $users_per_page,48 'search' => $usersearch,44 'number' => $users_per_page, 45 'offset' => ( $paged - 1 ) * $users_per_page, 46 'search' => $usersearch, 49 47 'blog_id' => 0, 50 'fields' => 'all_with_meta'48 'fields' => 'all_with_meta', 51 49 ); 52 50 53 51 if ( wp_is_large_network( 'users' ) ) { 54 52 $args['search'] = ltrim( $args['search'], '*' ); 55 } else if ( '' !== $args['search'] ) {53 } elseif ( '' !== $args['search'] ) { 56 54 $args['search'] = trim( $args['search'], '*' ); 57 55 $args['search'] = '*' . $args['search'] . '*'; … … 59 57 60 58 if ( $role === 'super' ) { 61 $logins = implode( "', '", get_super_admins() );59 $logins = implode( "', '", get_super_admins() ); 62 60 $args['include'] = $wpdb->get_col( "SELECT ID FROM $wpdb->users WHERE user_login IN ('$logins')" ); 63 61 } … … 68 66 * expensive count queries. 69 67 */ 70 if ( ! $usersearch && wp_is_large_network( 'users' ) ) {71 if ( ! isset($_REQUEST['orderby']) )68 if ( ! $usersearch && wp_is_large_network( 'users' ) ) { 69 if ( ! isset( $_REQUEST['orderby'] ) ) { 72 70 $_GET['orderby'] = $_REQUEST['orderby'] = 'id'; 73 if ( !isset($_REQUEST['order']) ) 71 } 72 if ( ! isset( $_REQUEST['order'] ) ) { 74 73 $_GET['order'] = $_REQUEST['order'] = 'DESC'; 74 } 75 75 $args['count_total'] = false; 76 76 } 77 77 78 if ( isset( $_REQUEST['orderby'] ) ) 78 if ( isset( $_REQUEST['orderby'] ) ) { 79 79 $args['orderby'] = $_REQUEST['orderby']; 80 81 if ( isset( $_REQUEST['order'] ) ) 80 } 81 82 if ( isset( $_REQUEST['order'] ) ) { 82 83 $args['order'] = $_REQUEST['order']; 84 } 83 85 84 86 if ( ! empty( $_REQUEST['mode'] ) ) { … … 97 99 $this->items = $wp_user_search->get_results(); 98 100 99 $this->set_pagination_args( array( 100 'total_items' => $wp_user_search->get_total(), 101 'per_page' => $users_per_page, 102 ) ); 103 } 104 105 /** 106 * 101 $this->set_pagination_args( 102 array( 103 'total_items' => $wp_user_search->get_total(), 104 'per_page' => $users_per_page, 105 ) 106 ); 107 } 108 109 /** 107 110 * @return array 108 111 */ 109 112 protected function get_bulk_actions() { 110 113 $actions = array(); 111 if ( current_user_can( 'delete_users' ) ) 114 if ( current_user_can( 'delete_users' ) ) { 112 115 $actions['delete'] = __( 'Delete' ); 113 $actions['spam'] = _x( 'Mark as Spam', 'user' ); 116 } 117 $actions['spam'] = _x( 'Mark as Spam', 'user' ); 114 118 $actions['notspam'] = _x( 'Not Spam', 'user' ); 115 119 … … 124 128 125 129 /** 126 *127 130 * @global string $role 128 131 * @return array … … 131 134 global $role; 132 135 133 $total_users = get_user_count();136 $total_users = get_user_count(); 134 137 $super_admins = get_super_admins(); 135 138 $total_admins = count( $super_admins ); 136 139 137 140 $current_link_attributes = $role !== 'super' ? ' class="current" aria-current="page"' : ''; 138 $role_links = array();139 $role_links['all'] = "<a href='" . network_admin_url( 'users.php' ) . "'$current_link_attributes>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';141 $role_links = array(); 142 $role_links['all'] = "<a href='" . network_admin_url( 'users.php' ) . "'$current_link_attributes>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>'; 140 143 $current_link_attributes = $role === 'super' ? ' class="current" aria-current="page"' : ''; 141 $role_links['super'] = "<a href='" . network_admin_url( 'users.php?role=super' ) . "'$current_link_attributes>" . sprintf( _n( 'Super Admin <span class="count">(%s)</span>', 'Super Admins <span class="count">(%s)</span>', $total_admins ), number_format_i18n( $total_admins ) ) . '</a>';144 $role_links['super'] = "<a href='" . network_admin_url( 'users.php?role=super' ) . "'$current_link_attributes>" . sprintf( _n( 'Super Admin <span class="count">(%s)</span>', 'Super Admins <span class="count">(%s)</span>', $total_admins ), number_format_i18n( $total_admins ) ) . '</a>'; 142 145 143 146 return $role_links; … … 152 155 global $mode; 153 156 154 parent::pagination ( $which );157 parent::pagination( $which ); 155 158 156 159 if ( 'top' === $which ) { … … 160 163 161 164 /** 162 *163 165 * @return array 164 166 */ … … 170 172 'email' => __( 'Email' ), 171 173 'registered' => _x( 'Registered', 'user' ), 172 'blogs' => __( 'Sites' ) 174 'blogs' => __( 'Sites' ), 173 175 ); 174 176 /** … … 184 186 185 187 /** 186 *187 188 * @return array 188 189 */ … … 209 210 ?> 210 211 <label class="screen-reader-text" for="blog_<?php echo $user->ID; ?>"><?php echo sprintf( __( 'Select %s' ), $user->user_login ); ?></label> 211 <input type="checkbox" id="blog_<?php echo $user->ID ?>" name="allusers[]" value="<?php echo esc_attr( $user->ID )?>" />212 <input type="checkbox" id="blog_<?php echo $user->ID; ?>" name="allusers[]" value="<?php echo esc_attr( $user->ID ); ?>" /> 212 213 <?php 213 214 } … … 233 234 public function column_username( $user ) { 234 235 $super_admins = get_super_admins(); 235 $avatar = get_avatar( $user->user_email, 32 );236 $avatar = get_avatar( $user->user_email, 32 ); 236 237 237 238 echo $avatar; … … 239 240 if ( current_user_can( 'edit_user', $user->ID ) ) { 240 241 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); 241 $edit = "<a href=\"{$edit_link}\">{$user->user_login}</a>";242 $edit = "<a href=\"{$edit_link}\">{$user->user_login}</a>"; 242 243 } else { 243 244 $edit = $user->user_login; … … 339 340 } 340 341 341 $path = ( $val->path === '/' ) ? '' : $val->path;342 $path = ( $val->path === '/' ) ? '' : $val->path; 342 343 echo '<span class="site-' . $val->site_id . '" >'; 343 echo '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . str_replace( '.' . get_network()->domain, '', $val->domain . $path ) . '</a>';344 echo '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) . '">' . str_replace( '.' . get_network()->domain, '', $val->domain . $path ) . '</a>'; 344 345 echo ' <small class="row-actions">'; 345 $actions = array();346 $actions['edit'] = '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . __( 'Edit' ) . '</a>';346 $actions = array(); 347 $actions['edit'] = '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) . '">' . __( 'Edit' ) . '</a>'; 347 348 348 349 $class = ''; … … 374 375 $actions = apply_filters( 'ms_user_list_site_actions', $actions, $val->userblog_id ); 375 376 376 $i =0;377 $i = 0; 377 378 $action_count = count( $actions ); 378 379 foreach ( $actions as $action => $link ) { … … 402 403 $class = ''; 403 404 404 $status_list = array( 'spam' => 'site-spammed', 'deleted' => 'site-deleted' ); 405 $status_list = array( 406 'spam' => 'site-spammed', 407 'deleted' => 'site-deleted', 408 ); 405 409 406 410 foreach ( $status_list as $status => $col ) { … … 449 453 450 454 if ( current_user_can( 'edit_user', $user->ID ) ) { 451 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );455 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); 452 456 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 453 457 }
Note: See TracChangeset
for help on using the changeset viewer.