]> git.mjollnir.org Git - moodle.git/commitdiff
get_my_courses() - bugfix in sitewide-login-as support.
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:07:34 +0000 (07:07 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:07:34 +0000 (07:07 +0000)
Oops. The supportfor login-as was buggy now with sitewide
loginas. Now works in both.

lib/datalib.php

index 76540e57834bcec0e821ca2c921606415f70cc02..232377c42416a18841cd183a9c10976b6eeaade0 100644 (file)
@@ -649,7 +649,8 @@ function get_my_courses($userid, $sort='visible DESC,sortorder ASC', $fields=NUL
     // because we use IN()
     //
     if ($userid === $USER->id) {
-        if (isset($USER->loginascontext)) {
+        if (isset($USER->loginascontext) 
+            && $USER->loginascontext->contextlevel == CONTEXT_COURSE) {
             // list _only_ this course
             // anything else is asking for trouble...
             $courseids = $USER->loginascontext->instanceid;