From 5d250bf0e19a494caa56c05c31867c1b0b87a9de Mon Sep 17 00:00:00 2001 From: Thorsten Siegmund Bartel Date: Wed, 6 Nov 2024 13:45:44 +0100 Subject: [PATCH] Implement 'allowstudents' config setting on course level to actually take effect. --- classes/plugin.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/plugin.php b/classes/plugin.php index 18f2e21c..8beb0ad7 100644 --- a/classes/plugin.php +++ b/classes/plugin.php @@ -42,7 +42,8 @@ class block_quickmail_plugin { * @throws required_capability_exception */ public static function require_user_can_send($sendtype, $user, $context, $page) { - if (!self::user_can_send($sendtype, $user, $context, $page, false)) { + $includestudentaccess = -1 !== (int) get_config('moodle', 'block_quickmail_allowstudents'); + if (!self::user_can_send($sendtype, $user, $context, $page, $includestudentaccess)) { $capability = $sendtype == 'broadcast' ? 'myaddinstance' : 'cansend'; throw new required_capability_exception($context, 'block/quickmail:' . $capability, 'nopermissions', '');