Changeset 16560 for trunk/wp-admin/includes/class-wp-users-list-table.php
- Timestamp:
- 11/24/2010 05:31:25 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-users-list-table.php
r16536 r16560 8 8 */ 9 9 class WP_Users_List_Table extends WP_List_Table { 10 11 var $site_id; 12 var $is_site_users; 13 14 function WP_Users_List_Table() { 15 $screen = get_current_screen(); 16 $this->is_site_users = ( 'site-users-network' == $screen->id ) ? true : false; 17 18 if ( $this->is_site_users ) 19 $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; 20 21 parent::WP_List_Table( array( 22 'singular' => 'user', 23 'plural' => 'users' 24 ) ); 25 } 10 26 11 27 function check_permissions() { 12 28 if ( !current_user_can('list_users') ) 13 29 wp_die(__('Cheatin’ uh?')); 30 31 if ( $this->is_site_users && !current_user_can('manage_sites') ) 32 wp_die(__('You do not have sufficient permissions to edit this site.')); 14 33 } 15 34 … … 31 50 'search' => $usersearch 32 51 ); 52 53 if ( $this->is_site_users ) 54 $args['blog_id'] = $this->site_id; 33 55 34 56 if ( isset( $_REQUEST['orderby'] ) ) … … 56 78 global $wp_roles, $role; 57 79 58 $users_of_blog = count_users(); 80 if ( $this->is_site_users ) { 81 $url = 'site-users.php?id=' . $this->site_id; 82 switch_to_blog( $this->site_id ); 83 $users_of_blog = count_users(); 84 restore_current_blog(); 85 } else { 86 $url = 'users.php'; 87 $users_of_blog = count_users(); 88 } 59 89 $total_users = $users_of_blog['total_users']; 60 90 $avail_roles =& $users_of_blog['avail_roles']; … … 64 94 $class = empty($role) ? ' class="current"' : ''; 65 95 $role_links = array(); 66 $role_links['all'] = "<a href=' users.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';96 $role_links['all'] = "<a href='$url'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>'; 67 97 foreach ( $wp_roles->get_names() as $this_role => $name ) { 68 98 if ( !isset($avail_roles[$this_role]) ) … … 79 109 /* translators: User role name with count */ 80 110 $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, $avail_roles[$this_role] ); 81 $role_links[$this_role] = "<a href=' users.php?role=$this_role'$class>$name</a>";111 $role_links[$this_role] = "<a href='" . add_query_arg( 'role', $this_role, $url ) . "'$class>$name</a>"; 82 112 } 83 113 … … 172 202 $user_object = sanitize_user_object( $user_object, 'display' ); 173 203 $email = $user_object->user_email; 204 205 if ( $this->is_site_users ) 206 $url = "site-users.php?id={$this->site_id}&"; 207 else 208 $url = 'users.php?'; 174 209 175 210 $checkbox = ''; … … 198 233 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=delete&user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Delete' ) . "</a>"; 199 234 if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) ) 200 $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=remove&user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>";235 $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url."action=remove&user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>"; 201 236 $actions = apply_filters( 'user_row_actions', $actions, $user_object ); 202 237 $edit .= $this->row_actions( $actions );
Note: See TracChangeset
for help on using the changeset viewer.