diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-12-07 18:09:28 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-12-07 18:09:28 +0000 |
commit | 71eac6dddc79d5b2ad3567969743269534bfc9d6 (patch) | |
tree | f530c7cf41b36b93e5cf3932c247bb8b785f4386 /modules/user/user.module | |
parent | 2ea6ad44a55eef096376ebf625a402a38ac0c698 (diff) | |
download | brdo-71eac6dddc79d5b2ad3567969743269534bfc9d6.tar.gz brdo-71eac6dddc79d5b2ad3567969743269534bfc9d6.tar.bz2 |
- Made the who's online block adhere better to the max user setting.
Diffstat (limited to 'modules/user/user.module')
-rw-r--r-- | modules/user/user.module | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/modules/user/user.module b/modules/user/user.module index cac94eb2a..037e46662 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -402,19 +402,23 @@ function user_block($op = "list", $delta = 0) { } if (user_access("access user list") && $total_users) { + // Display a list of currently online users $max_users = variable_get("user_block_max_list_count", 10); - $items = array(); - while (($max_users--) && $uid = db_fetch_object($users)) { - $items[] = format_name(user_load(array("uid" => $uid->uid))); - } + if ($max_users) { + $items = array(); - if (db_fetch_object($users)) { - $items[] = "..."; - } + while ($max_users-- && $uid = db_fetch_object($users)) { + $items[] = format_name(user_load(array("uid" => $uid->uid))); + } + + if (db_fetch_object($users)) { + $items[] = "..."; + } - if ($items) { - $output .= theme("item_list", $items, t("Online users:")); + if ($items) { + $output .= theme("item_list", $items, t("Online users:")); + } } } $block["subject"] = t("Who's online"); |