MDL-21782 fixed wrong removal of hidden courses again - lot more thanks to Jay Knight...
authorPetr Skoda <skodak@moodle.org>
Tue, 27 Jul 2010 21:28:29 +0000 (21:28 +0000)
committerPetr Skoda <skodak@moodle.org>
Tue, 27 Jul 2010 21:28:29 +0000 (21:28 +0000)
lib/enrollib.php

index 62c8710..85b14af 100644 (file)
@@ -612,11 +612,11 @@ function enrol_get_users_courses($userid, $onlyactive = false, $fields = NULL, $
         if ($onlyactive) {
             if (!$course->visible) {
                 if (!$context = get_context_instance(CONTEXT_COURSE, $id)) {
-                    unset($course[$id]);
+                    unset($courses[$id]);
                     continue;
                 }
                 if (!has_capability('moodle/course:viewhiddencourses', $context, $userid)) {
-                    unset($course[$id]);
+                    unset($courses[$id]);
                     continue;
                 }
             }