- Patch 181 by Jeremy: made the "Who is online" block respect the "user list length"

settings.
4.3.x
Dries Buytaert 2003-12-04 06:18:52 +00:00
parent a0ff8d51b1
commit 1105bc5cb4
1 changed files with 5 additions and 2 deletions

View File

@ -687,15 +687,18 @@ function statistics_display_online_block() {
/* Display a list of currently online users */
$max_users = variable_get("statistics_block_online_max_cnt", 10);
$items = array();
while ($uid = db_fetch_object($users)) {
while (($max_users--) && $uid = db_fetch_object($users)) {
$user = user_load(array("uid" => $uid->uid));
/* Display only max_length characters of username */
$items[] = format_name($user);
}
if ($items) {
if ($items) {
$output .= "<br /><br />";
$output .= theme("theme_item_list", $items, variable_get("statistics_block_online_subtitle", "Online users:"));
if (db_fetch_object($users)) {
$output .= "<br />...";
}
}
}
}