From ed24576728c8fd5706229597ad6169f871c78247 Mon Sep 17 00:00:00 2001 From: Tristan Mackay Date: Tue, 10 Apr 2018 11:53:46 +0800 Subject: [PATCH] #176 Only get users details who are enrolled within the course --- classes/task/email_certificate_task.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/classes/task/email_certificate_task.php b/classes/task/email_certificate_task.php index 3f13c01..b150ca9 100644 --- a/classes/task/email_certificate_task.php +++ b/classes/task/email_certificate_task.php @@ -71,8 +71,7 @@ class email_certificate_task extends \core\task\scheduled_task { // Get the person we are going to send this email on behalf of. // Look through the teachers. - if ($teachers = get_users_by_capability($context, 'moodle/course:update', 'u.*', 'u.id ASC', - '', '', '', '', false, true)) { + if ($teachers = get_enrolled_users($context, 'moodle/course:update')) { $teachers = sort_by_roleassignment_authority($teachers, $context); $userfrom = reset($teachers); } else { // Ok, no teachers, use administrator name.