MDL-22884 fixed sloppy userid related bugs in enrol code - big thanks to Andrew for...
authorPetr Skoda <skodak@moodle.org>
Tue, 22 Jun 2010 06:26:39 +0000 (06:26 +0000)
committerPetr Skoda <skodak@moodle.org>
Tue, 22 Jun 2010 06:26:39 +0000 (06:26 +0000)
lib/enrollib.php

index 29b779c..74dacce 100644 (file)
@@ -493,7 +493,7 @@ function enrol_get_users_courses($userid, $onlyactive = false, $fields = NULL, $
     global $DB;
 
     // Guest account does not have any courses
-    if (isguestuser($userid) or !empty($userid)) {
+    if (isguestuser($userid) or empty($userid)) {
         return(array());
     }
 
@@ -558,7 +558,7 @@ function enrol_get_users_courses($userid, $onlyactive = false, $fields = NULL, $
            $ccjoin
            $wheres
           $orderby";
-    $params['userid']  = $USER->id;
+    $params['userid']  = $userid;
 
     $courses = $DB->get_records_sql($sql, $params);