]> git.mjollnir.org Git - moodle.git/commitdiff
fixed a bug with user listing where user_lastaccess entries are not set, e.g. after...
authortoyomoyo <toyomoyo>
Thu, 5 Oct 2006 08:54:35 +0000 (08:54 +0000)
committertoyomoyo <toyomoyo>
Thu, 5 Oct 2006 08:54:35 +0000 (08:54 +0000)
user/index.php

index 85319dcd17bf5b3f4447b756f9600be80ea4f5a7..e8cfef1cfdd8f26b04502cf8641fe4a48815645a 100644 (file)
     //$select .= $course->enrolperiod?', s.timeend ':'';
     $from   = "FROM {$CFG->prefix}user u INNER JOIN
     {$CFG->prefix}role_assignments r on u.id=r.userid LEFT OUTER JOIN
-    {$CFG->prefix}user_lastaccess ul on r.userid=ul.userid ";
+    {$CFG->prefix}user_lastaccess ul on (r.userid=ul.userid and ul.courseid = $course->id)"; 
+    // join on 2 conditions
+    // otherwise we run into the problem of having records in ul table, but not relevant course
+    // and user record is not pulled out
     $where  = "WHERE (r.contextid = $context->id OR r.contextid in $listofcontexts)
         AND u.deleted = 0 $selectrole
         AND (ul.courseid = $course->id OR ul.courseid IS NULL)