From 0cecdd0ab54962feebd171353800ab1a419f0f5e Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Tue, 28 Sep 2021 22:07:21 +0800 Subject: [PATCH] Do not encode html entities in emails (#457) --- CHANGES.md | 1 + classes/task/email_certificate_task.php | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 68499e2..8221775 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,7 @@ Note - All hash comments refer to the issue number. Eg. #169 refers to https://g ### Fixed - Fix places not using the multi-language filter (#433). - Fix user IDs in the issue table not being mapped during restore (#449). +- Fix emails displaying HTML entities encoded (#457). ### Added - You can now choose the course short or full name to display (#415). diff --git a/classes/task/email_certificate_task.php b/classes/task/email_certificate_task.php index a4ac712..f3cc2a3 100644 --- a/classes/task/email_certificate_task.php +++ b/classes/task/email_certificate_task.php @@ -211,7 +211,8 @@ class email_certificate_task extends \core\task\scheduled_task { $subject = get_string('emailstudentsubject', 'customcert', $info); $message = $textrenderer->render($renderable); $messagehtml = $htmlrenderer->render($renderable); - email_to_user($user, fullname($userfrom), $subject, $message, $messagehtml, $tempfile, $filename); + email_to_user($user, fullname($userfrom), html_entity_decode($subject), $message, $messagehtml, + $tempfile, $filename); } if ($customcert->emailteachers) { @@ -222,8 +223,8 @@ class email_certificate_task extends \core\task\scheduled_task { $message = $textrenderer->render($renderable); $messagehtml = $htmlrenderer->render($renderable); foreach ($teachers as $teacher) { - email_to_user($teacher, fullname($userfrom), $subject, $message, $messagehtml, $tempfile, - $filename); + email_to_user($teacher, fullname($userfrom), html_entity_decode($subject), $message, $messagehtml, + $tempfile, $filename); } } @@ -242,8 +243,8 @@ class email_certificate_task extends \core\task\scheduled_task { $emailuser = new \stdClass(); $emailuser->id = -1; $emailuser->email = $email; - email_to_user($emailuser, fullname($userfrom), $subject, $message, $messagehtml, $tempfile, - $filename); + email_to_user($emailuser, fullname($userfrom), html_entity_decode($subject), $message, + $messagehtml, $tempfile, $filename); } } }