MDL-26262 fix online users block error on non-course pages
authorPetr Skoda <commits@skodak.org>
Sun, 6 Feb 2011 21:04:44 +0000 (22:04 +0100)
committerPetr Skoda <commits@skodak.org>
Sun, 6 Feb 2011 21:04:44 +0000 (22:04 +0100)
blocks/online_users/block_online_users.php

index 4fb8972..622f96b 100644 (file)
@@ -54,7 +54,7 @@ class block_online_users extends block_base {
 
         $userfields = user_picture::fields('u', array('username'));
 
-        if ($this->page->course->id == SITEID) {  // Site-level
+        if ($this->page->course->id == SITEID or $this->page->context->contextlevel < CONTEXT_COURSE) {  // Site-level
             $sql = "SELECT $userfields, MAX(u.lastaccess) AS lastaccess
                       FROM {user} u $groupmembers
                      WHERE u.lastaccess > $timefrom