From 0251377852173e686add1bd8bbaf770420e4cf11 Mon Sep 17 00:00:00 2001 From: Daniel Thee Roperto Date: Tue, 6 Sep 2016 22:39:47 +1000 Subject: [PATCH] Issue #16 - Check if plugin is enabled before adding menu items. --- settings.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/settings.php b/settings.php index fa082c6..5af7589 100644 --- a/settings.php +++ b/settings.php @@ -24,8 +24,11 @@ */ defined('MOODLE_INTERNAL') || die; -// FIXME If plugin not installed, it is still generating the category Outage under Auth Plugins. -if ($hassiteconfig) { +// Check if plugin is enabled, if not do not create menu entries. +$enabled = core_plugin_manager::instance()->get_enabled_plugins('auth'); +$enabled = array_key_exists('outage', $enabled); + +if ($hassiteconfig && $enabled) { // Configure default settings page. $settings->visiblename = get_string('menudefaults', 'auth_outage'); $settings->add( @@ -54,4 +57,4 @@ if ($hassiteconfig) { new moodle_url($CFG->wwwroot . '/auth/outage/list.php') ) ); -} \ No newline at end of file +}