]> git.mjollnir.org Git - moodle.git/commitdiff
changed to outer join as user_lastaccess table could contain null
authortoyomoyo <toyomoyo>
Wed, 13 Sep 2006 05:29:26 +0000 (05:29 +0000)
committertoyomoyo <toyomoyo>
Wed, 13 Sep 2006 05:29:26 +0000 (05:29 +0000)
user/index.php

index bc414a076cabd5ac0eb249b8dbc209c4501d1133..3fd84b8af5b80f6669674c30e6a7566a798ed2e3 100644 (file)
@@ -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 ";