diff options
author | Dries Buytaert <dries@buytaert.net> | 2002-11-09 13:59:36 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2002-11-09 13:59:36 +0000 |
commit | 562df8fe43f8794317c974dae463f5470cfdc497 (patch) | |
tree | 73d897d51f8b1873eff41193733d309495d01aea /modules/user.module | |
parent | 29adfb4086c8ef6102d9f22f5351382485444be5 (diff) | |
download | brdo-562df8fe43f8794317c974dae463f5470cfdc497.tar.gz brdo-562df8fe43f8794317c974dae463f5470cfdc497.tar.bz2 |
* 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.
Diffstat (limited to 'modules/user.module')
-rw-r--r-- | modules/user.module | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/modules/user.module b/modules/user.module index 23fc80a4a..d51974d34 100644 --- a/modules/user.module +++ b/modules/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 = "<div align=\"center\">\n"; $output .= "<form action=\"". drupal_url(array("mod" => "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 .= "<br />\n<input name=\"edit[op]\" type=\"submit\" value=\"". t("Log in") ."\" /><br />\n"; $output .= "</form></div>\n"; + if (variable_get("user_register", 1)) { - $output .= "» ". lm(t("Register"), array("mod" => "user", "op" => "register"), "", array("title" => t("Create a new user account."))) ."<br />\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"] = "<div style=\"{ width: 155; }\">$output</div>"; return $block; } break; case 1: if ($user->uid) { - // Display account settings: - $block["subject"] = $user->name; - - $output = "<div style=\"{ width: 155; }\">\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("<br />\n", $links); + $output = implode($content, "<br />"); - $output .= "</div>"; - $block["content"] = $output; + $block["subject"] = $user->name; + $block["content"] = "<div style=\"{ width: 155; }\">$output</div>"; 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)) ."<br />"; - } - 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 .= "<p>» ". lm(t("E-mail new password"), array("mod" => "user", "op" => "password")). "<br />"; + $output .= "<p>» ". lm(t("Request new password"), array("mod" => "user", "op" => "password")). "<br />"; if (variable_get("user_register", 1)) { $output .= "» ". lm(t("Create new account"), array("mod" => "user", "op" => "register")); } |