- Timestamp:
- 07/14/2015 05:46:13 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-ms-users-list-table.php
r33195 r33270 258 258 259 259 /** 260 * @since 4.3.0 261 * @access protected 262 * 263 * @param WP_User $user 264 * @param string $classes 265 * @param string $data 266 * @param string $primary 267 */ 268 protected function _column_blogs( $user, $classes, $data, $primary ) { 269 echo '<td class="', $classes, ' has-row-actions" ', $data, '>'; 270 echo $this->column_blogs( $user ); 271 echo $this->handle_row_actions( $user, 'blogs', $primary ); 272 echo '</td>'; 273 } 274 275 /** 260 276 * Handles the blogs/sites column output. 261 277 * … … 336 352 } 337 353 338 /**339 * Handles columns output for a single row in the table.340 *341 * @since 4.3.0342 * @access public343 *344 * @param WP_User $item The current WP_User object.345 */346 public function single_row_columns( $item ) {347 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();348 349 foreach ( $columns as $column_name => $column_display_name ) {350 $classes = "$column_name column-$column_name";351 if ( $primary === $column_name || 'blogs' === $column_name ) {352 $classes .= ' has-row-actions';353 }354 355 if ( $primary === $column_name ) {356 $classes .= ' column-primary';357 }358 359 if ( in_array( $column_name, $hidden ) ) {360 $classes .= ' hidden';361 }362 363 $data = 'data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';364 365 $attributes = "class='$classes' $data";366 367 if ( 'cb' === $column_name ) {368 echo '<th scope="row" class="check-column">';369 370 $this->column_cb( $item );371 372 echo '</th>';373 } elseif ( method_exists( $this, 'column_' . $column_name ) ) {374 echo "<td $attributes>";375 376 call_user_func( array( $this, 'column_' . $column_name ), $item );377 378 echo $this->handle_row_actions( $item, $column_name, $primary );379 echo "</td>";380 } else {381 echo "<td $attributes>";382 383 $this->column_default( $item, $column_name );384 385 echo $this->handle_row_actions( $item, $column_name, $primary );386 echo "</td>";387 }388 }389 }390 391 354 public function display_rows() { 392 355 foreach ( $this->items as $user ) { … … 433 396 */ 434 397 protected function handle_row_actions( $user, $column_name, $primary ) { 398 if ( $primary !== $column_name ) { 399 return ''; 400 } 401 435 402 $super_admins = get_super_admins(); 436 403 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); 437 404 438 if ( $primary === $column_name ) { 439 $actions = array(); 440 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 441 442 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) { 443 $actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>'; 444 } 445 446 /** 447 * Filter the action links displayed under each user in the Network Admin Users list table. 448 * 449 * @since 3.2.0 450 * 451 * @param array $actions An array of action links to be displayed. 452 * Default 'Edit', 'Delete'. 453 * @param WP_User $user WP_User object. 454 */ 455 $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); 456 return $this->row_actions( $actions ); 457 } 405 $actions = array(); 406 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 407 408 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) { 409 $actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>'; 410 } 411 412 /** 413 * Filter the action links displayed under each user in the Network Admin Users list table. 414 * 415 * @since 3.2.0 416 * 417 * @param array $actions An array of action links to be displayed. 418 * Default 'Edit', 'Delete'. 419 * @param WP_User $user WP_User object. 420 */ 421 $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); 422 return $this->row_actions( $actions ); 458 423 } 459 424 }
Note: See TracChangeset
for help on using the changeset viewer.