diff --git a/enrol/locallib.php b/enrol/locallib.php index f8b7ca44a0b..4fc3dcebdad 100644 --- a/enrol/locallib.php +++ b/enrol/locallib.php @@ -554,7 +554,7 @@ class course_enrolment_manager { } /** - * Gets all of the enrolment plugins that are active for this course. + * Gets all of the enrolment plugins that are available for this course. * * @param bool $onlyenabled return only enabled enrol plugins * @return array diff --git a/user/index.php b/user/index.php index e73c3f29e61..d1fc5bd282f 100644 --- a/user/index.php +++ b/user/index.php @@ -254,8 +254,14 @@ if ($bulkoperations) { } if ($context->id != $frontpagectx->id) { - $plugins = $manager->get_enrolment_plugins(); - foreach ($plugins as $plugin) { + $instances = $manager->get_enrolment_instances(); + $plugins = $manager->get_enrolment_plugins(false); + foreach ($instances as $key => $instance) { + if (!isset($plugins[$instance->enrol])) { + // Weird, some broken stuff in plugin. + continue; + } + $plugin = $plugins[$instance->enrol]; $bulkoperations = $plugin->get_bulk_operations($manager); $pluginoptions = [];