Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-43200

Web service call enrol_manual_enrol_users enrols users to wrong courses if manual enrolments has/have been disabled in the course(s)

    Details

      Description

      This very ugly bug is caused by not resetting $instance before usage in enrol_users() from enrol/manual/externallib.php

      When manual enrolments is disabled in the course where users are being enrolled to, the previous value of $instance is used which means user is then enrolled to a wrong course.

      Here's the fix:

      --- externallib.php.dist	2013-11-29 06:52:44.000000000 +0200
      +++ externallib.php	2013-12-04 15:01:55.651222101 +0200
      @@ -109,6 +109,7 @@
                   }
       
                   // Check manual enrolment plugin instance is enabled/exist.
      +            $instance = null;
                   $enrolinstances = enrol_get_instances($enrolment['courseid'], true);
                   foreach ($enrolinstances as $courseenrolinstance) {
                     if ($courseenrolinstance->enrol == "manual") {
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Mar/14