Ticket #26564: 26564.diff
File 26564.diff, 3.8 KB (added by , 11 years ago) |
---|
-
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; … … 152 203 echo '</div>'; 153 204 } 154 205 206 /** 207 * Capture the bulk action required, and return it. 208 * 209 * Overriden from the base class implementation to capture the role change drop-down. 210 * 211 * @since 3.1.0 212 * @see WP_List_Table::current_action() 213 * @return string The bulk action required. 214 */ 155 215 function current_action() { 156 216 if ( isset($_REQUEST['changeit']) && !empty($_REQUEST['new_role']) ) 157 217 return 'promote'; … … 159 219 return parent::current_action(); 160 220 } 161 221 222 /** 223 * @since 3.1.0 224 * @see WP_List_Table::get_columns() 225 * @return array Array in which the key is the ID of the column, and the value is the description. 226 */ 162 227 function get_columns() { 163 228 $c = array( 164 229 'cb' => '<input type="checkbox" />', … … 175 240 return $c; 176 241 } 177 242 243 /** 244 * @since 3.1.0 245 * @see WP_List_Table::get_sortable_columns() 246 */ 178 247 function get_sortable_columns() { 179 248 $c = array( 180 249 'username' => 'login', … … 188 257 return $c; 189 258 } 190 259 260 /** 261 * @since 3.1.0 262 * @see WP_List_Table::display_rows() 263 */ 191 264 function display_rows() { 192 265 // Query the post counts for this page 193 266 if ( ! $this->is_site_users ) … … 216 289 /** 217 290 * Generate HTML for a single row on the users.php admin panel. 218 291 * 219 * @since 2.1.0292 * @since 3.1.0 220 293 * 221 294 * @param object $user_object 222 295 * @param string $style Optional. Attributes added to the TR element. Must be sanitized.