Fix problems with hidden columns on network users screen. Props ocean90. See #14579

git-svn-id: http://svn.automattic.com/wordpress/trunk@16601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu 2010-11-28 17:39:44 +00:00
parent b1e7c513b7
commit cc540d502a
3 changed files with 32 additions and 38 deletions

View File

@ -310,12 +310,12 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
break; break;
case 'plugins': ?> case 'plugins': ?>
<?php if ( has_filter( 'wpmublogsaction' ) ) { <?php if ( has_filter( 'wpmublogsaction' ) ) {
echo "<td valign='top'class='$column_name column-$column_name'$style>"; echo "<td valign='top' class='$column_name column-$column_name'$style>";
do_action( 'wpmublogsaction', $blog['blog_id'] ); ?> do_action( 'wpmublogsaction', $blog['blog_id'] ); ?>
</td> </td>
<?php } ?> <?php }
<?php break; break;
default: default:
echo "<td class='$column_name column-$column_name'$style>"; echo "<td class='$column_name column-$column_name'$style>";

View File

@ -334,7 +334,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
echo "</div></td>"; echo "</div></td>";
break; break;
break;
default: default:
echo "<td class='$column_name column-$column_name'$style>"; echo "<td class='$column_name column-$column_name'$style>";
do_action( 'manage_themes_custom_column', $column_name, $theme_key, $theme ); do_action( 'manage_themes_custom_column', $column_name, $theme_key, $theme );

View File

@ -17,7 +17,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
} }
function prepare_items() { function prepare_items() {
global $usersearch, $role, $wpdb; global $usersearch, $role, $wpdb, $mode;
$usersearch = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; $usersearch = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';
@ -55,6 +55,8 @@ class WP_MS_Users_List_Table extends WP_List_Table {
if ( isset( $_REQUEST['order'] ) ) if ( isset( $_REQUEST['order'] ) )
$args['order'] = $_REQUEST['order']; $args['order'] = $_REQUEST['order'];
$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
// Query the user IDs for this page // Query the user IDs for this page
$wp_user_search = new WP_User_Query( $args ); $wp_user_search = new WP_User_Query( $args );
@ -109,7 +111,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
function get_columns() { function get_columns() {
$users_columns = array( $users_columns = array(
'cb' => '<input type="checkbox" />', 'cb' => '<input type="checkbox" />',
'login' => __( 'Username' ), 'username' => __( 'Username' ),
'name' => __( 'Name' ), 'name' => __( 'Name' ),
'email' => __( 'E-mail' ), 'email' => __( 'E-mail' ),
'registered' => _x( 'Registered', 'user' ), 'registered' => _x( 'Registered', 'user' ),
@ -122,7 +124,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
function get_sortable_columns() { function get_sortable_columns() {
return array( return array(
'login' => 'login', 'username' => 'login',
'name' => 'name', 'name' => 'name',
'email' => 'email', 'email' => 'email',
'registered' => 'id', 'registered' => 'id',
@ -132,10 +134,10 @@ class WP_MS_Users_List_Table extends WP_List_Table {
function display_rows() { function display_rows() {
global $current_site, $mode; global $current_site, $mode;
$class = ''; $alt = '';
$super_admins = get_super_admins(); $super_admins = get_super_admins();
foreach ( $this->items as $user ) { foreach ( $this->items as $user ) {
$class = ( 'alternate' == $class ) ? '' : 'alternate'; $alt = ( 'alternate' == $alt ) ? '' : 'alternate';
$status_list = array( 'spam' => 'site-spammed', 'deleted' => 'site-deleted' ); $status_list = array( 'spam' => 'site-spammed', 'deleted' => 'site-deleted' );
@ -145,18 +147,21 @@ class WP_MS_Users_List_Table extends WP_List_Table {
} }
?> ?>
<tr class="<?php echo $class; ?>"> <tr class="<?php echo $alt; ?>">
<?php <?php
list( $columns, $hidden ) = $this->get_column_info(); list( $columns, $hidden ) = $this->get_column_info();
foreach ( $columns as $column_name => $column_display_name ) : foreach ( $columns as $column_name => $column_display_name ) :
$class = "class='$column_name column-$column_name'";
$style = ''; $style = '';
if ( in_array( $column_name, $hidden ) ) if ( in_array( $column_name, $hidden ) )
$style = ' style="display:none;"'; $style = ' style="display:none;"';
$attributes = "$class$style"; $attributes = "$class$style";
switch ( $column_name ) { switch ( $column_name ) {
case 'cb': ?> case 'cb': ?>
<th scope="row" class="check-column"> <th scope="row" class="check-column">
@ -165,18 +170,11 @@ class WP_MS_Users_List_Table extends WP_List_Table {
<?php <?php
break; break;
case 'id': ?> case 'username':
<th valign="top" scope="row">
<?php echo $user->ID ?>
</th>
<?php
break;
case 'login':
$avatar = get_avatar( $user->user_email, 32 ); $avatar = get_avatar( $user->user_email, 32 );
$edit_link = ( get_current_user_id() == $user->ID ) ? 'profile.php' : 'user-edit.php?user_id=' . $user->ID; $edit_link = ( get_current_user_id() == $user->ID ) ? 'profile.php' : 'user-edit.php?user_id=' . $user->ID;
?>
<td class="username column-username"> echo "<td $attributes>"; ?>
<?php echo $avatar; ?><strong><a href="<?php echo esc_url( self_admin_url( $edit_link ) ); ?>" class="edit"><?php echo stripslashes( $user->user_login ); ?></a><?php <?php echo $avatar; ?><strong><a href="<?php echo esc_url( self_admin_url( $edit_link ) ); ?>" class="edit"><?php echo stripslashes( $user->user_login ); ?></a><?php
if ( in_array( $user->user_login, $super_admins ) ) if ( in_array( $user->user_login, $super_admins ) )
echo ' - ' . __( 'Super Admin' ); echo ' - ' . __( 'Super Admin' );
@ -197,14 +195,12 @@ class WP_MS_Users_List_Table extends WP_List_Table {
<?php <?php
break; break;
case 'name': ?> case 'name':
<td class="name column-name"><?php echo "$user->first_name $user->last_name"; ?></td> echo "<td $attributes>$user->first_name $user->last_name</td>";
<?php
break; break;
case 'email': ?> case 'email':
<td class="email column-email"><a href="mailto:<?php echo $user->user_email ?>"><?php echo $user->user_email ?></a></td> echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a></td>";
<?php
break; break;
case 'registered': case 'registered':
@ -212,16 +208,13 @@ class WP_MS_Users_List_Table extends WP_List_Table {
$date = 'Y/m/d'; $date = 'Y/m/d';
else else
$date = 'Y/m/d \<\b\r \/\> g:i:s a'; $date = 'Y/m/d \<\b\r \/\> g:i:s a';
?>
<td><?php echo mysql2date( $date, $user->user_registered ); ?></td> echo "<td $attributes>" . mysql2date( $date, $user->user_registered ) . "</td>";
<?php
break; break;
case 'blogs': case 'blogs':
$blogs = get_blogs_of_user( $user->ID, true ); $blogs = get_blogs_of_user( $user->ID, true );
?> echo "<td $attributes>";
<td>
<?php
if ( is_array( $blogs ) ) { if ( is_array( $blogs ) ) {
foreach ( (array) $blogs as $key => $val ) { foreach ( (array) $blogs as $key => $val ) {
$path = ( $val->path == '/' ) ? '' : $val->path; $path = ( $val->path == '/' ) ? '' : $val->path;
@ -245,9 +238,10 @@ class WP_MS_Users_List_Table extends WP_List_Table {
<?php <?php
break; break;
default: ?> default:
<td><?php echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID ); ?></td> echo "<td $attributes>";
<?php echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID );
echo "</td>";
break; break;
} }
endforeach endforeach