Permalink
Browse files

MDL-26045 fix invalid sql join when separate group mode enabled

  • Loading branch information...
1 parent 17e0390 commit fb7dd39ce78b08633157a4ce1aaca6f9658451e1 @skodak skodak committed Jan 18, 2011
Showing with 4 additions and 6 deletions.
  1. +4 −6 blocks/online_users/block_online_users.php
@@ -43,8 +43,6 @@ function get_content() {
$groupmembers = "";
$groupselect = "";
- $rafrom = "";
- $rawhere = "";
$params = array();
//Add this to the SQL to show only group users
@@ -78,22 +76,22 @@ function get_content() {
$params = array_merge($params, $eparams);
$sql = "SELECT $userfields, MAX(ul.timeaccess) AS lastaccess
- FROM {user_lastaccess} ul, {user} u $groupmembers $rafrom
+ FROM {user_lastaccess} ul $groupmembers, {user} u
JOIN ($esqljoin) euj ON euj.id = u.id
WHERE ul.timeaccess > $timefrom
AND u.id = ul.userid
AND ul.courseid = :courseid
- $groupselect $rawhere
+ $groupselect
GROUP BY $userfields
ORDER BY lastaccess DESC";
$csql = "SELECT u.id
- FROM {user_lastaccess} ul, {user} u $groupmembers $rafrom
+ FROM {user_lastaccess} ul $groupmembers, {user} u
JOIN ($esqljoin) euj ON euj.id = u.id
WHERE ul.timeaccess > $timefrom
AND u.id = ul.userid
AND ul.courseid = :courseid
- $groupselect $rawhere
+ $groupselect
GROUP BY u.id";
$params['courseid'] = $this->page->course->id;

0 comments on commit fb7dd39

Please sign in to comment.