Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.8.4, 1.9
-
None
-
MOODLE_18_STABLE, MOODLE_19_STABLE
-
MOODLE_18_STABLE, MOODLE_19_STABLE
Description
From http://moodle.org/mod/forum/discuss.php?d=93109
"Any time a user is enrolled in a course via LDAP, they are unenrolled when they log in if the course is set to be unavailable to students (invisible). [...] Running enrol_ldap_sync.php properly restores enrollments to all courses. It's only when users actually log in (or when an admin uses login as) that the users are unenrolled, at which point only running enrol_ldap_sync.php will restore the enrollments."
This is because of this piece of code in setup_enrolments():
} else { // the course object exists before we call...
if ($course_obj->visible==0)
}
This is a leftover from the pre-roles era, when we didn't have moodle/course:viewhiddencourses. But now we don't need this at all, and in fact it's buggy, as everybody is unenrolled from the course. If we keep the enrolment, the role & capability checks will hide the course to those not having the right cap, while allowing the rest to enter the course.
The attached patch fixes the issue for 1.8, 1.9 and HEAD.
Saludos. Iñaki.
Attachments
Issue Links
- has a clone
-
MDL-14105 Prevent automatic unenrol from courses when course is invisible
-
- Closed
-