From: toyomoyo Date: Wed, 13 Sep 2006 05:29:26 +0000 (+0000) Subject: changed to outer join as user_lastaccess table could contain null X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8ca1053a4575b51b3048106965396e543d18f983;p=moodle.git changed to outer join as user_lastaccess table could contain null --- diff --git a/user/index.php b/user/index.php index bc414a076c..3fd84b8af5 100644 --- a/user/index.php +++ b/user/index.php @@ -381,13 +381,10 @@ function checkchecked(form) { $select = 'SELECT u.id, u.username, u.firstname, u.lastname, u.email, u.city, u.country, u.picture, u.lang, u.timezone, u.emailstop, u.maildisplay, ul.timeaccess AS lastaccess '; // s.lastaccess //$select .= $course->enrolperiod?', s.timeend ':''; - $from = "FROM {$CFG->prefix}user u, - {$CFG->prefix}role_assignments r, - {$CFG->prefix}user_lastaccess ul "; - $where = "WHERE - r.userid = u.id - AND u.id = ul.userid - AND (r.contextid = $context->id OR r.contextid in $listofcontexts) + $from = "FROM {$CFG->prefix}user u INNER JOIN + {$CFG->prefix}role_assignments r on u.id=r.userid LEFT JOIN + {$CFG->prefix}user_lastaccess ul on u.id=ul.userid "; + $where = "WHERE (r.contextid = $context->id OR r.contextid in $listofcontexts) AND u.deleted = 0 AND r.roleid = $roleid AND ul.courseid = $course->id ";