diff --git a/lib/pluginlib.php b/lib/pluginlib.php index 9d788a765ed..b2be2b9c7da 100644 --- a/lib/pluginlib.php +++ b/lib/pluginlib.php @@ -1529,16 +1529,28 @@ class plugintype_enrol extends plugintype_base implements plugin_information { */ class plugintype_message extends plugintype_base implements plugin_information { + private $processors; + + protected function __construct() { + global $CFG; + require_once($CFG->dirroot . '/message/lib.php'); + $this->processors = get_message_processors(); + } + /** * @see plugin_information::get_settings_url() */ public function get_settings_url() { - if (file_exists($this->full_path('settings.php')) or file_exists($this->full_path('settingstree.php'))) { - return new moodle_url('/admin/settings.php', array('section' => 'messagesetting' . $this->name)); + if (isset($this->processors[$this->name])) { + $processor = $this->processors[$this->name]; } else { return parent::get_settings_url(); } + + if ($processor->available && $processor->hassettings) { + return new moodle_url('settings.php', array('section' => 'messagesetting'.$processor->name)); + } } }