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)

    XMLWordPrintable

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") {
      

      Attachments

        Activity

          People

            apsdehal Amanpreet Singh
            jval Jarkko Ala-Louvesniemi
            Petr Skoda Petr Skoda
            Sam Hemelryk Sam Hemelryk
            Andrew Lyons Andrew Lyons
            David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo, Juan Leyva, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              10/Mar/14