Hello,
I'm using the self_enrol method to allow students to enrol in a course.
Clicking the enrolment button at the bottom of the enrol/index.php page is supposed to enrol the user, and redirect him/her to course/view.php.
And this is where I'm facing a strange issue : at times, the user is not taken to course/view.php but to the URL of an image, that I uploaded to Moodle and use in an HTML block ! It's a basic illustration with nothing special. The image is shown at the center on the page, no Moodle menus around, it's really the image URL.
I couldn't say exactly when it happens. At first I thought it was linked to the user's (in-)ability to view the sections of the course, which in my case are hidden at the moment. But when performing multiple self enrolments/unenrolments, the issue does not happen everytime. It seems that it happens a few times, then doesn't happen anymore for a given user.
The bug is hard to replay, seems pretty randomish.
I don't use any enrolment key. The course is open and visible, but most of the sections are not. That said, the first section (section0) is open and visible for students.
Where does this "redirection" come from ? Is Moodle trying to redirect the user to an invisible course element, thus leading to an incorrect place ? I tried to look at the execution flow in the code but I just ended up confused.
Any clue would be greatly appreciated.
Thanks a lot,
Mathias