From fce94ad7898834fdfe2f10d3666bd39d75b5f74f Mon Sep 17 00:00:00 2001 From: Gareth Barnard <1058419+gjb2048@users.noreply.github.com> Date: Thu, 20 Dec 2018 13:59:54 +0000 Subject: [PATCH] Participants menu course and module pages with show / hide setting in the header settings. --- CHANGES.txt | 2 ++ classes/output/core_renderer.php | 5 ++++- lang/en/theme_essential.php | 2 ++ settings.php | 8 ++++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 2063cc82..c74c7d4c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,7 @@ New in 3.5.1.4 ============== +- FIX: Participants menu only on course and module pages. +- NEW: Show / hide the participants menu with the 'participantsmenu' setting in the 'Header' settings. New in 3.5.1.3 ============== diff --git a/classes/output/core_renderer.php b/classes/output/core_renderer.php index 11e2e0b8..a531d019 100644 --- a/classes/output/core_renderer.php +++ b/classes/output/core_renderer.php @@ -1297,7 +1297,10 @@ public function custom_menu_activitystream() { */ public function custom_menu_participants() { $output = ''; - if (!isguestuser()) { + if ((!isguestuser()) && + ((\theme_essential\toolbox::get_setting('participantsmenu')) && + (($this->page->pagelayout == 'course') || ($this->page->pagelayout == 'incourse'))) + ) { $users = $this->get_enrolled_users(); if (!empty($users)) { /* Not using a custom menu so to make use of the user picture rendering code, otherwise a lot of work to do and diff --git a/lang/en/theme_essential.php b/lang/en/theme_essential.php index 8f0c3fca..11e912a8 100644 --- a/lang/en/theme_essential.php +++ b/lang/en/theme_essential.php @@ -238,6 +238,8 @@ // Participants menu. $string['gotopeople'] = 'Go to people'; +$string['participantsmenu'] = 'Participants menu'; +$string['participantsmenudesc'] = 'Show the participants menu in the course and module pages.'; // User menu. $string['usermenu'] = 'User menu'; diff --git a/settings.php b/settings.php index cdb355bc..054fff59 100644 --- a/settings.php +++ b/settings.php @@ -1227,6 +1227,14 @@ $setting->set_updatedcallback('theme_reset_all_caches'); $essentialsettingsheader->add($setting); + // Participants menu. + $name = 'theme_essential/participantsmenu'; + $title = get_string('participantsmenu', 'theme_essential'); + $description = get_string('participantsmenudesc', 'theme_essential'); + $default = true; + $setting = new admin_setting_configcheckbox($name, $title, $description, $default); + $essentialsettingsheader->add($setting); + // Choose breadcrumbstyle. $name = 'theme_essential/breadcrumbstyle'; $title = get_string('breadcrumbstyle', 'theme_essential');