diff --git a/blocks/online_users/block_online_users.php b/blocks/online_users/block_online_users.php
index 697724ac123..c0d10062f1a 100644
--- a/blocks/online_users/block_online_users.php
+++ b/blocks/online_users/block_online_users.php
@@ -72,9 +72,9 @@ class block_online_users extends block_base {
ul.userid = u.id
$courseselect
$timeselect
- $groupselect ".sql_paging_limit(0,20);
+ $groupselect ";
- if ($pusers = get_records_sql($SQL)) {
+ if ($pusers = get_records_sql($SQL, 0, 20)) {
foreach ($pusers as $puser) {
$puser->fullname = fullname($puser);
$users[$puser->id] = $puser;
@@ -95,8 +95,14 @@ class block_online_users extends block_base {
foreach ($users as $user) {
$this->content->text .= '
';
$timeago = format_time(time() - max($user->timeaccess, $user->lastaccess)); //bruno to calculate correctly on frontpage
- $this->content->text .= print_user_picture($user->id, $COURSE->id, $user->picture, 16, true).' ';
- $this->content->text .= ''.$user->fullname.'';
+ if ($user->username == 'guest') {
+ $this->content->text .= print_user_picture($user->id, $COURSE->id, $user->picture, 16, true, false).' ';
+ $this->content->text .= get_string('guestuser');
+
+ } else {
+ $this->content->text .= print_user_picture($user->id, $COURSE->id, $user->picture, 16, true).' ';
+ $this->content->text .= ''.$user->fullname.'';
+ }
if (!empty($USER->id) and ($USER->id != $user->id) and !empty($CFG->messaging) and
!isguest() and $user->username != 'guest') { // Only when logged in and messaging active etc
$this->content->text .= "\n".' '