From 5336e619652ce28a6eba0749fbbbe5e174a641c5 Mon Sep 17 00:00:00 2001 From: All0ne <53848749+All0ne@users.noreply.github.com> Date: Fri, 8 Nov 2024 01:36:43 +0100 Subject: [PATCH] Update local_contact.php Bugfix: email subject no set using subject field --- classes/local_contact.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/local_contact.php b/classes/local_contact.php index fc5712c..b1a1564 100644 --- a/classes/local_contact.php +++ b/classes/local_contact.php @@ -290,11 +290,13 @@ public function sendmessage($email, $name, $sendconfirmationemail = false) { // Include site name in subject field. $subject .= '[' . format_string($SITE->shortname, true, ['escape' => false, 'context' => $systemcontext]) . '] '; } - $subject .= optional_param( + /**$subject .= optional_param( get_string('field-subject', 'local_contact'), get_string('defaultsubject', 'local_contact'), PARAM_TEXT - ); + ); */ + // Use form-subject for mail-subject; if form-subject empty use defaultsubject + $subject .= (isset($_POST['subject']) && !empty($_POST['subject'])) ? $_POST['subject'] : get_string('defaultsubject', 'local_contact'); // Build the body of the email using user-entered information.