Commit 71eac6dd authored by Dries's avatar Dries

- Made the who's online block adhere better to the max user setting.
parent 2ea6ad44
......@@ -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");
......
......@@ -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");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment