Skip to content

Commit c81d203

Browse files
committed
Only get teachers when emailing certificates if required (#531)
1 parent 15a1bc0 commit c81d203

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

classes/task/email_certificate_task.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ public function execute() {
7373
// Get the person we are going to send this email on behalf of.
7474
$userfrom = \core_user::get_noreply_user();
7575

76-
// Store teachers for later.
77-
$teachers = get_enrolled_users($context, 'moodle/course:update');
78-
7976
$courseshortname = format_string($customcert->courseshortname, true, ['context' => $context]);
8077
$coursefullname = format_string($customcert->coursefullname, true, ['context' => $context]);
8178
$certificatename = format_string($customcert->name, true, ['context' => $context]);
@@ -140,6 +137,8 @@ public function execute() {
140137
}
141138

142139
if ($customcert->emailteachers) {
140+
$teachers = get_enrolled_users($context, 'moodle/course:update');
141+
143142
$renderable = new \mod_customcert\output\email_certificate(false, $userfullname, $courseshortname,
144143
$coursefullname, $certificatename, $context->instanceid);
145144

0 commit comments

Comments
 (0)