Ticket #26203: 26203.diff
| File 26203.diff, 5.3 KB (added by , 12 years ago) |
|---|
-
src/wp-admin/includes/class-wp-users-list-table.php
9 9 */ 10 10 class WP_Users_List_Table extends WP_List_Table { 11 11 12 /** 13 * The site ID that this table is being generated for. 14 * 15 * @since 3.1.0 16 * @var int $site_id The site ID. 17 */ 12 18 var $site_id; 19 20 /** 21 * True if the table is being generated for the multisite site users page. 22 * 23 * @since 3.1.0 24 * @var bool $is_site_users 25 */ 13 26 var $is_site_users; 14 27 28 /** 29 * Constructor 30 * 31 * @since 3.1.0 32 * @see WP_List_Table::__construct() 33 */ 15 34 function __construct( $args = array() ) { 16 35 parent::__construct( array( 17 36 'singular' => 'user', … … 25 44 $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; 26 45 } 27 46 47 /** 48 * @since 3.1.0 49 * @see WP_List_Table::__construct() 50 */ 28 51 function ajax_user_can() { 29 52 if ( $this->is_site_users ) 30 53 return current_user_can( 'manage_sites' ); … … 32 55 return current_user_can( 'list_users' ); 33 56 } 34 57 58 /** 59 * @since 3.1.0 60 * @see WP_List_Table::prepare_items() 61 */ 35 62 function prepare_items() { 36 63 global $role, $usersearch; 37 64 … … 75 102 ) ); 76 103 } 77 104 105 /** 106 * @since 3.1.0 107 * @see WP_List_Table::no_items() 108 */ 78 109 function no_items() { 79 110 _e( 'No matching users were found.' ); 80 111 } 81 112 113 /** 114 * Returns an associative array listing all the views that can be used with this table. 115 * 116 * Provides a list of roles, andd user count for that role for easy filter of the user table. 117 * 118 * @since 3.1.0 119 * @see WP_List_Table::get_views() 120 * @return array An array of HTML links, one for each view. 121 */ 82 122 function get_views() { 83 123 global $wp_roles, $role; 84 124 … … 119 159 return $role_links; 120 160 } 121 161 162 /** 163 * @since 3.1.0 164 * @see WP_List_Table::get_bulk_actions() 165 */ 122 166 function get_bulk_actions() { 123 167 $actions = array(); 124 168 … … 133 177 return $actions; 134 178 } 135 179 180 /** 181 * Output the controls to allow user roles to be changed in bulk. 182 * 183 * @since 3.1.0 184 * @see WP_List_Table::extra_tablenav() 185 * @param string $which Whether this is being invoked above ("top") or below the table ("bottom"). 186 */ 136 187 function extra_tablenav( $which ) { 137 188 if ( 'top' != $which ) 138 189 return; … … 148 199 submit_button( __( 'Change' ), 'button', 'changeit', false ); 149 200 endif; 150 201 202 /** 203 * Triggered after the extra tablenav on the user list page 204 * 205 * @since 3.5.0 206 */ 151 207 do_action( 'restrict_manage_users' ); 152 208 echo '</div>'; 153 209 } 154 210 211 /** 212 * Capture the bulk action required, and return it. 213 * 214 * Overriden from the base class implementation to capture the role change drop-down. 215 * 216 * @since 3.1.0 217 * @see WP_List_Table::current_action() 218 * @return string The bulk action required. 219 */ 155 220 function current_action() { 156 221 if ( isset($_REQUEST['changeit']) && !empty($_REQUEST['new_role']) ) 157 222 return 'promote'; … … 159 224 return parent::current_action(); 160 225 } 161 226 227 /** 228 * @since 3.1.0 229 * @see WP_List_Table::get_columns() 230 * @return array Array in which the key is the ID of the column, and the value is the description. 231 */ 162 232 function get_columns() { 163 233 $c = array( 164 234 'cb' => '<input type="checkbox" />', … … 175 245 return $c; 176 246 } 177 247 248 /** 249 * @since 3.1.0 250 * @see WP_List_Table::get_sortable_columns() 251 */ 178 252 function get_sortable_columns() { 179 253 $c = array( 180 254 'username' => 'login', … … 188 262 return $c; 189 263 } 190 264 265 /** 266 * @since 3.1.0 267 * @see WP_List_Table::display_rows() 268 */ 191 269 function display_rows() { 192 270 // Query the post counts for this page 193 271 if ( ! $this->is_site_users ) … … 216 294 /** 217 295 * Generate HTML for a single row on the users.php admin panel. 218 296 * 219 * @since 2.1.0297 * @since 3.1.0 220 298 * 221 299 * @param object $user_object 222 300 * @param string $style Optional. Attributes added to the TR element. Must be sanitized. … … 257 335 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=delete&user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Delete' ) . "</a>"; 258 336 if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) ) 259 337 $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url."action=remove&user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>"; 338 /** 339 * The actions available against a user. 340 * 341 * @since 3.1.0 342 * @var array $actions Array of actions available 343 * @var WP_User $user_object The user object being listed. 344 */ 260 345 $actions = apply_filters( 'user_row_actions', $actions, $user_object ); 261 346 $edit .= $this->row_actions( $actions ); 262 347 … … 313 398 break; 314 399 default: 315 400 $r .= "<td $attributes>"; 401 /** 402 * Provide output for a custom column on the users list table. 403 * 404 * @since 3.1.0 405 * @var string The current content for the column. 406 * @var string The column being rendered. 407 * @var int The user ID being rendered. 408 */ 316 409 $r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID ); 317 410 $r .= "</td>"; 318 411 }