MDL-59823 users: Enrol bulk op course instance

The commit message above was my best attempt at meeting the very short restrictions on commit message first lines.

What it needed to say was: "Only show bulk enrolment operations for enrolment methods that have an instance in the course"
This commit is contained in:
Damyon Wiese
2017-08-17 12:03:52 +08:00
parent ca56095250
commit f4ddc4ecd3
2 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -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
+8 -2
View File
@@ -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 = [];