From 8d013b16662097d422ffcd60658ce64bc2b1fbd8 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 21 Aug 2003 15:47:50 +0000 Subject: - Applied Moshe's tablesort patch! Note that I changed the arrow images because those of Moshe where not identical. --- modules/user.module | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'modules/user.module') diff --git a/modules/user.module b/modules/user.module index c05bec7c5..cae3014fc 100644 --- a/modules/user.module +++ b/modules/user.module @@ -1608,21 +1608,29 @@ function user_admin_edit($edit = array()) { function user_admin_account() { $query = arg(3); - $queries = array("ORDER BY u.timestamp DESC", "ORDER BY u.uid DESC", "WHERE u.status = 0 ORDER BY u.uid DESC"); + $queries = array("", "WHERE u.status = 0"); foreach (user_roles(1) as $key => $value) { - $queries[] = "WHERE r.name = '$value' ORDER BY u.uid DESC"; + $queries[] = "WHERE r.name = '$value'"; } - $result = pager_query("SELECT u.uid, u.name, u.timestamp FROM {role} r INNER JOIN {users} u ON r.rid = u.rid ". $queries[$query ? $query : 0], 50); + $sql = "SELECT u.uid, u.name, u.timestamp FROM {role} r INNER JOIN {users} u ON r.rid = u.rid ". $queries[$query ? $query : 0]; + + $header = array( + array ("data" => t("uid"), "field" => "u.uid"), + array ("data" => t("username"), "field" => "u.name"), + array ("data" => t("last access"), "field" => "u.timestamp", "sort" => "asc"), + t("operations") + ); + $sql .= tablesort_sql($header); + $result = pager_query($sql, 50); - $header = array(t("username"), t("last access"), t("operations")); while ($account = db_fetch_object($result)) { - $rows[] = array(format_name($account), format_date($account->timestamp, "small"), l(t("edit account"), "admin/user/edit/$account->uid")); + $rows[] = array($account->uid, format_name($account), format_date($account->timestamp, "small"), l(t("edit account"), "admin/user/edit/$account->uid")); } - $pager = pager_display(NULL, 50, 0, "admin"); + $pager = pager_display(NULL, 50, 0, "admin", tablesort_pager()); if (!empty($pager)) { - $rows[] = array(array("data" => $pager, "colspan" => 3)); + $rows[] = array(array("data" => $pager, "colspan" => 4)); } return table($header, $rows); } -- cgit v1.2.3