From 562df8fe43f8794317c974dae463f5470cfdc497 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 9 Nov 2002 13:59:36 +0000 Subject: * Added Jeremy's pager: "This is a simple, generic pager for Drupal-CVS. It is designed to be easily themeable and expandable. The code is highly-commented to enhance readability." "Pagers are constructed by combining the provided pieces (all of which can be easily modified to display the text or image you prefer) into your custom pager." * Statistics module fixes by Jeremy: - removed superfluous check for existence of watchdog() - saving changes in admin page displays status and returns same page - no longer return 1971/01/01 in "view statistics" table - switched from "!=" to "<>" in SQL queries for ANSI-SQL compliance - switched from "MAX(timestamp) as timestamp" to "MAX(timestamp) as max_timestamp" moving towards ANSI-SQL compliance. * Added a "theme_item_list" function to format itemized lists. Also changed a couple of modules to take advantage of it. Makes for a more consistent UI. --- modules/user/user.module | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'modules/user/user.module') diff --git a/modules/user/user.module b/modules/user/user.module index 23fc80a4a..d51974d34 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -314,8 +314,6 @@ function user_block($op = "list", $delta = 0) { switch ($delta) { case 0: if (!$user->uid) { - $block["subject"] = t("Log in"); - $output = "
\n"; $output .= "
"user", "op" => "login"), "module") ."\" method=\"post\">\n"; // Save the referer. We record where the user came from such that we @@ -334,46 +332,49 @@ function user_block($op = "list", $delta = 0) { $output .= "
\n
\n"; $output .= "
\n"; + if (variable_get("user_register", 1)) { - $output .= "» ". lm(t("Register"), array("mod" => "user", "op" => "register"), "", array("title" => t("Create a new user account."))) ."
\n"; + $items[] = lm(t("Create new account"), array("mod" => "user", "op" => "register"), "", array("title" => t("Create a new user account."))); } - $output .= "» ". lm(t("New password"), array("mod" => "user", "op" => "password"), "", array("title" => t("Request new password via e-mail."))); + $items[] = lm(t("Request new password"), array("mod" => "user", "op" => "password"), "", array("title" => t("Request new password via e-mail."))); - $block["content"] = $output; + $output .= theme_invoke("theme_item_list", $items); + + $block["subject"] = t("Log in"); + $block["content"] = "
$output
"; return $block; } break; case 1: if ($user->uid) { - // Display account settings: - $block["subject"] = $user->name; - - $output = "
\n"; + $content[] = theme_invoke("theme_item_list", module_invoke_all("link", "menu.create")); + $content[] = theme_invoke("theme_item_list", module_invoke_all("link", "menu.view")); + $content[] = theme_invoke("theme_item_list", module_invoke_all("link", "menu.settings")); + $content[] = theme_invoke("theme_item_list", module_invoke_all("link", "menu.misc")); - $links = array_merge(module_invoke_all("link", "menu.create"), array(""), module_invoke_all("link", "menu.view"), array(""), module_invoke_all("link", "menu.settings"), array(""), module_invoke_all("link", "menu.misc")); - $output .= @implode("
\n", $links); + $output = implode($content, "
"); - $output .= "
"; - $block["content"] = $output; + $block["subject"] = $user->name; + $block["content"] = "
$output
"; return $block; } break; case 2: + + $result = db_query("SELECT uid, name FROM users WHERE status != '0' ORDER BY uid DESC LIMIT 5"); + while ($account = db_fetch_object($result)) { + $items[] = lm((strlen($account->name) > 15 ? substr($account->name, 0, 15) . '...' : $account->name), array("mod" =>user, "op" => "view", "id" => $account->uid)); + } + + $output = theme_invoke("theme_item_list", $items); + $block["subject"] = t("Who's new"); - $block["content"] = user_new_users(); + $block["content"] = $output; return $block; } } } -function user_new_users() { - $result = db_query("SELECT uid, name FROM users WHERE status != '0' ORDER BY uid DESC LIMIT 5"); - while ($account = db_fetch_object($result)) { - $output .= lm((strlen($account->name) > 15 ? substr($account->name, 0, 15) . '...' : $account->name), array("mod" =>user, "op" => "view", "id" => $account->uid)) ."
"; - } - return $output; -} - function user_link($type) { if ($type == "page") { $links[] = lm(t("user account"), array("mod" => "user"), "", array("title" => t("Create a user account, request a new password or edit your account settings."))); @@ -619,7 +620,7 @@ function user_login($edit = array(), $msg = "") { $output .= form_password(t("Password"), "pass", $pass, 20, 64, t("Enter the password that accompanies your username.")); $output .= form_checkbox(t("Remember me"), "remember_me", 1, 0, 0); $output .= form_submit(t("Log in")); - $output .= "

» ". lm(t("E-mail new password"), array("mod" => "user", "op" => "password")). "
"; + $output .= "

» ". lm(t("Request new password"), array("mod" => "user", "op" => "password")). "
"; if (variable_get("user_register", 1)) { $output .= "» ". lm(t("Create new account"), array("mod" => "user", "op" => "register")); } -- cgit v1.2.3