From ca560952504877811aeaca627c242f79a219ff25 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Thu, 17 Aug 2017 11:34:52 +0800 Subject: [PATCH] MDL-59822 users: No enrolments on frontpage Hide enrolment status and bulk actions from the frontpage. --- user/classes/participants_table.php | 2 +- user/index.php | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/user/classes/participants_table.php b/user/classes/participants_table.php index aa8e2f9f203..5c9f678542d 100644 --- a/user/classes/participants_table.php +++ b/user/classes/participants_table.php @@ -191,7 +191,7 @@ class participants_table extends \table_sql { } $canreviewenrol = has_capability('moodle/course:enrolreview', $context); - if ($canreviewenrol) { + if ($canreviewenrol && $courseid != SITEID) { $columns[] = 'status'; $headers[] = get_string('participationstatus', 'enrol'); $this->no_sorting('status'); diff --git a/user/index.php b/user/index.php index 73ee0282fb6..e73c3f29e61 100644 --- a/user/index.php +++ b/user/index.php @@ -253,19 +253,21 @@ if ($bulkoperations) { $displaylist['groupaddnote.php'] = get_string('groupaddnewnote', 'notes'); } - $plugins = $manager->get_enrolment_plugins(); - foreach ($plugins as $plugin) { - $bulkoperations = $plugin->get_bulk_operations($manager); + if ($context->id != $frontpagectx->id) { + $plugins = $manager->get_enrolment_plugins(); + foreach ($plugins as $plugin) { + $bulkoperations = $plugin->get_bulk_operations($manager); - $pluginoptions = []; - foreach ($bulkoperations as $key => $bulkoperation) { - $params = ['plugin' => $plugin->get_name(), 'operation' => $key]; - $url = new moodle_url('bulkchange.php', $params); - $pluginoptions[$url->out(false)] = $bulkoperation->get_title(); - } - if (!empty($pluginoptions)) { - $name = get_string('pluginname', 'enrol_' . $plugin->get_name()); - $displaylist[] = [$name => $pluginoptions]; + $pluginoptions = []; + foreach ($bulkoperations as $key => $bulkoperation) { + $params = ['plugin' => $plugin->get_name(), 'operation' => $key]; + $url = new moodle_url('bulkchange.php', $params); + $pluginoptions[$url->out(false)] = $bulkoperation->get_title(); + } + if (!empty($pluginoptions)) { + $name = get_string('pluginname', 'enrol_' . $plugin->get_name()); + $displaylist[] = [$name => $pluginoptions]; + } } }