diff --git a/enrol/manual/lib.php b/enrol/manual/lib.php index a346a08a8b5..cd44272aed2 100644 --- a/enrol/manual/lib.php +++ b/enrol/manual/lib.php @@ -197,14 +197,14 @@ class enrol_manual_plugin extends enrol_plugin { global $CFG, $PAGE; require_once($CFG->dirroot.'/cohort/lib.php'); + static $called = false; + $instance = null; - $instances = array(); foreach ($manager->get_enrolment_instances() as $tempinstance) { if ($tempinstance->enrol == 'manual') { if ($instance === null) { $instance = $tempinstance; } - $instances[] = array('id' => $tempinstance->id, 'name' => $this->get_instance_name($tempinstance)); } } if (empty($instance)) { @@ -222,7 +222,11 @@ class enrol_manual_plugin extends enrol_plugin { $context = context_course::instance($instance->courseid); $arguments = array('contextid' => $context->id); - $PAGE->requires->js_call_amd('enrol_manual/quickenrolment', 'init', array($arguments)); + if (!$called) { + $called = true; + // Calling the following more than once will cause unexpected results. + $PAGE->requires->js_call_amd('enrol_manual/quickenrolment', 'init', array($arguments)); + } return $button; } diff --git a/user/index.php b/user/index.php index b6f171d19ad..59767d43aac 100644 --- a/user/index.php +++ b/user/index.php @@ -362,6 +362,8 @@ echo ''; // Userlist. $enrolrenderer = $PAGE->get_renderer('core_enrol'); echo '