Skip to content

Commit

Permalink
Only get teachers when emailing certificates if required (#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjnelson committed Oct 12, 2024
1 parent d8f2aa9 commit b5a249b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions classes/task/email_certificate_task.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ public function execute() {
// Get the person we are going to send this email on behalf of.
$userfrom = \core_user::get_noreply_user();

// Store teachers for later.
$teachers = get_enrolled_users($context, 'moodle/course:update');

$courseshortname = format_string($customcert->courseshortname, true, ['context' => $context]);
$coursefullname = format_string($customcert->coursefullname, true, ['context' => $context]);
$certificatename = format_string($customcert->name, true, ['context' => $context]);
Expand Down Expand Up @@ -140,6 +137,8 @@ public function execute() {
}

if ($customcert->emailteachers) {
$teachers = get_enrolled_users($context, 'moodle/course:update');

$renderable = new \mod_customcert\output\email_certificate(false, $userfullname, $courseshortname,
$coursefullname, $certificatename, $context->instanceid);

Expand Down

0 comments on commit b5a249b

Please sign in to comment.