Commit 4a7abb95 authored by Dries's avatar Dries
Browse files

- Patch #45312 by Robin and Zen: made theme_user_list() more like...

- Patch #45312 by Robin and Zen: made theme_user_list() more like theme_item_list(), made it robust for empty lists.
parent 56d0d76f
...@@ -584,9 +584,7 @@ function user_block($op = 'list', $delta = 0, $edit = array()) { ...@@ -584,9 +584,7 @@ function user_block($op = 'list', $delta = 0, $edit = array()) {
$items[] = $account; $items[] = $account;
} }
if ($items) { $output .= theme('user_list', $items, t('Online users'));
$output .= theme('user_list', $items, t('Online users'));
}
$block['subject'] = t('Who\'s online'); $block['subject'] = t('Who\'s online');
$block['content'] = $output; $block['content'] = $output;
...@@ -646,8 +644,10 @@ function theme_user_profile($account, $fields) { ...@@ -646,8 +644,10 @@ function theme_user_profile($account, $fields) {
* @ingroup themeable * @ingroup themeable
*/ */
function theme_user_list($users, $title = NULL) { function theme_user_list($users, $title = NULL) {
foreach ($users as $user) { if (!empty($users)) {
$items[] = theme('username', $user); foreach ($users as $user) {
$items[] = theme('username', $user);
}
} }
return theme('item_list', $items, $title); return theme('item_list', $items, $title);
} }
......
...@@ -584,9 +584,7 @@ function user_block($op = 'list', $delta = 0, $edit = array()) { ...@@ -584,9 +584,7 @@ function user_block($op = 'list', $delta = 0, $edit = array()) {
$items[] = $account; $items[] = $account;
} }
if ($items) { $output .= theme('user_list', $items, t('Online users'));
$output .= theme('user_list', $items, t('Online users'));
}
$block['subject'] = t('Who\'s online'); $block['subject'] = t('Who\'s online');
$block['content'] = $output; $block['content'] = $output;
...@@ -646,8 +644,10 @@ function theme_user_profile($account, $fields) { ...@@ -646,8 +644,10 @@ function theme_user_profile($account, $fields) {
* @ingroup themeable * @ingroup themeable
*/ */
function theme_user_list($users, $title = NULL) { function theme_user_list($users, $title = NULL) {
foreach ($users as $user) { if (!empty($users)) {
$items[] = theme('username', $user); foreach ($users as $user) {
$items[] = theme('username', $user);
}
} }
return theme('item_list', $items, $title); return theme('item_list', $items, $title);
} }
......
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