From 20e180de643039f38aae58f633843e422541132f Mon Sep 17 00:00:00 2001 From: ryan Date: Sun, 17 Feb 2008 20:16:22 +0000 Subject: [PATCH] Remove pseudo role group by git-svn-id: http://svn.automattic.com/wordpress/trunk@6886 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/user.php | 8 +++++--- wp-admin/users.php | 24 ++++++++---------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index 73922294d6..612a03ecd7 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -291,10 +291,11 @@ class WP_User_Search { var $page; var $role; var $raw_page; - var $users_per_page = 50; + var $users_per_page = 2; var $first_user; var $last_user; var $query_limit; + var $query_sort; var $query_from_where; var $total_users_for_query = 0; var $too_many_total_users = false; @@ -315,7 +316,8 @@ class WP_User_Search { function prepare_query() { global $wpdb; $this->first_user = ($this->page - 1) * $this->users_per_page; - $this->query_limit = 'LIMIT ' . $this->first_user . ',' . $this->users_per_page; + $this->query_limit = ' LIMIT ' . $this->first_user . ',' . $this->users_per_page; + $this->query_sort = ' ORDER BY user_login'; $search_sql = ''; if ( $this->search_term ) { $searches = array(); @@ -337,7 +339,7 @@ class WP_User_Search { function query() { global $wpdb; - $this->results = $wpdb->get_col('SELECT ID ' . $this->query_from_where . $this->query_limit); + $this->results = $wpdb->get_col('SELECT ID ' . $this->query_from_where . $this->query_sort . $this->query_limit); if ( $this->results ) $this->total_users_for_query = $wpdb->get_var('SELECT COUNT(ID) ' . $this->query_from_where); // no limit diff --git a/wp-admin/users.php b/wp-admin/users.php index c9be764e30..2b52ac1865 100644 --- a/wp-admin/users.php +++ b/wp-admin/users.php @@ -185,14 +185,6 @@ default: // Query the users $wp_user_search = new WP_User_Search($_GET['usersearch'], $_GET['userspage'], $_GET['role']); - // Make the user objects - foreach ( $wp_user_search->get_results() as $userid ) { - $tmp_user = new WP_User($userid); - $roles = $tmp_user->roles; - $role = array_shift($roles); - $roleclasses[$role][$tmp_user->user_login] = $tmp_user; - } - if ( isset($_GET['update']) ) : switch($_GET['update']) { case 'del': @@ -260,6 +252,7 @@ foreach ( (array) $users_of_blog as $b_user ) { $avail_roles[$b_role]++; } } +unset($users_of_blog); foreach ( $wp_roles->get_names() as $role => $name ) { if ( !isset($avail_roles[$role]) ) @@ -333,20 +326,19 @@ unset($role_links); + $roleclass) { - uksort($roleclass, "strnatcasecmp"); -?> -get_results() as $userid ) { + $user_object = new WP_User($userid); + $roles = $user->roles; + $role = array_shift($roles); + + $style = ''; $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"'; echo "\n\t" . user_row($user_object, $style, $role); } ?> - -