From 3f835e30e651f7cf4acb8acd321d6a569394de25 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Thu, 26 Oct 2023 15:53:48 +0700 Subject: [PATCH] Removed useless "Subject:" from email templates (#993) * Removed useless "Subject:" from email templates * Updated * Updated --- group.php | 3 --- library/includes/ucp/email.php | 1 - library/includes/ucp/register.php | 2 -- library/includes/ucp/sendpasswd.php | 1 - library/language/source/email/group_added.html | 4 +--- library/language/source/email/group_approved.html | 4 +--- library/language/source/email/group_request.html | 4 +--- library/language/source/email/privmsg_notify.html | 4 +--- library/language/source/email/profile_send_email.html | 2 +- library/language/source/email/topic_notify.html | 4 +--- library/language/source/email/user_activate.html | 4 +--- .../language/source/email/user_activate_passwd.html | 4 +--- library/language/source/email/user_welcome.html | 2 -- .../language/source/email/user_welcome_inactive.html | 2 -- library/language/source/main.php | 3 +-- privmsg.php | 1 - src/Emailer.php | 10 +++++----- 17 files changed, 14 insertions(+), 41 deletions(-) diff --git a/group.php b/group.php index c600768d7..035c75ca8 100644 --- a/group.php +++ b/group.php @@ -178,7 +178,6 @@ if (!$group_id) { $emailer->set_template('group_request', $moderator['user_lang']); $emailer->assign_vars([ 'USER' => $userdata['username'], - 'SITENAME' => $bb_cfg['sitename'], 'GROUP_MODERATOR' => $moderator['username'], 'U_GROUP' => make_url(GROUP_URL . $group_id) ]); @@ -234,7 +233,6 @@ if (!$group_id) { $emailer->set_template('group_added', $row['user_lang']); $emailer->assign_vars([ - 'SITENAME' => $bb_cfg['sitename'], 'GROUP_NAME' => $group_info['group_name'], 'U_GROUP' => make_url(GROUP_URL . $group_id) ]); @@ -293,7 +291,6 @@ if (!$group_id) { $emailer->set_template('group_approved', $row['user_lang']); $emailer->assign_vars([ - 'SITENAME' => $bb_cfg['sitename'], 'GROUP_NAME' => $group_info['group_name'], 'U_GROUP' => make_url(GROUP_URL . $group_id) ]); diff --git a/library/includes/ucp/email.php b/library/includes/ucp/email.php index d125307a2..5123a24dd 100644 --- a/library/includes/ucp/email.php +++ b/library/includes/ucp/email.php @@ -60,7 +60,6 @@ if ($row = DB()->fetch_row($sql)) { $emailer->set_template('profile_send_email', $user_lang); $emailer->assign_vars([ - 'SITENAME' => $bb_cfg['sitename'], 'FROM_USERNAME' => $userdata['username'], 'TO_USERNAME' => $username, 'MESSAGE' => $message diff --git a/library/includes/ucp/register.php b/library/includes/ucp/register.php index eedc71558..01ae04bea 100644 --- a/library/includes/ucp/register.php +++ b/library/includes/ucp/register.php @@ -578,7 +578,6 @@ if ($submit && !$errors) { $emailer->set_template($email_template, $user_lang); $emailer->assign_vars([ - 'SITENAME' => $bb_cfg['sitename'], 'WELCOME_MSG' => sprintf($lang['WELCOME_SUBJECT'], $bb_cfg['sitename']), 'USERNAME' => html_entity_decode($username), 'PASSWORD' => $new_pass, @@ -610,7 +609,6 @@ if ($submit && !$errors) { $emailer->set_template('user_activate', $pr_data['user_lang']); $emailer->assign_vars([ - 'SITENAME' => $bb_cfg['sitename'], 'USERNAME' => html_entity_decode($username), 'U_ACTIVATE' => make_url("profile.php?mode=activate&u={$pr_data['user_id']}&act_key=$user_actkey"), ]); diff --git a/library/includes/ucp/sendpasswd.php b/library/includes/ucp/sendpasswd.php index bd8551c2e..ad9c54ff5 100644 --- a/library/includes/ucp/sendpasswd.php +++ b/library/includes/ucp/sendpasswd.php @@ -55,7 +55,6 @@ if (isset($_POST['submit'])) { $emailer->set_template('user_activate_passwd', $row['user_lang']); $emailer->assign_vars([ - 'SITENAME' => $bb_cfg['sitename'], 'USERNAME' => $username, 'PASSWORD' => $user_password, 'U_ACTIVATE' => make_url('profile.php?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey) diff --git a/library/language/source/email/group_added.html b/library/language/source/email/group_added.html index 04ae3ab50..e6737cfc9 100644 --- a/library/language/source/email/group_added.html +++ b/library/language/source/email/group_added.html @@ -1,6 +1,4 @@ -Subject: You have been added to this usergroup - -Congratulations, +Congratulations! You have been added to the "{GROUP_NAME}" group on {SITENAME}. This action was done by the group moderator or the site administrator, contact them for more information. diff --git a/library/language/source/email/group_approved.html b/library/language/source/email/group_approved.html index bc31d88b3..4652b9150 100644 --- a/library/language/source/email/group_approved.html +++ b/library/language/source/email/group_approved.html @@ -1,6 +1,4 @@ -Subject: Your request has been approved - -Congratulations, +Congratulations! Your request to join the "{GROUP_NAME}" group on {SITENAME} has been approved. Click on the following link to see your group membership. diff --git a/library/language/source/email/group_request.html b/library/language/source/email/group_request.html index 5e458be7a..b12c65dc1 100644 --- a/library/language/source/email/group_request.html +++ b/library/language/source/email/group_request.html @@ -1,6 +1,4 @@ -Subject: A request to join your group has been made - -Dear {GROUP_MODERATOR}, +Dear {GROUP_MODERATOR}. A user {USER} has requested to join a group you moderator on {SITENAME}. To approve or deny this request for group membership please visit the following link: diff --git a/library/language/source/email/privmsg_notify.html b/library/language/source/email/privmsg_notify.html index d3409b4d3..927b29e85 100644 --- a/library/language/source/email/privmsg_notify.html +++ b/library/language/source/email/privmsg_notify.html @@ -1,6 +1,4 @@ -Subject: New Private Message has arrived - -Hello {USERNAME}, +Hello, {USERNAME}! You have received a new private message to your account on "{SITENAME}" and you have requested that you be notified on this event. You can view your new message by clicking on the following link: diff --git a/library/language/source/email/profile_send_email.html b/library/language/source/email/profile_send_email.html index 231efe133..2cad6d57f 100644 --- a/library/language/source/email/profile_send_email.html +++ b/library/language/source/email/profile_send_email.html @@ -1,4 +1,4 @@ -Hello {TO_USERNAME}, +Hello, {TO_USERNAME}! The following is an email sent to you by {FROM_USERNAME} via your account on {SITENAME}. If this message is spam, contains abusive or other comments you find offensive please contact the webmaster of the board at the following address: diff --git a/library/language/source/email/topic_notify.html b/library/language/source/email/topic_notify.html index 79a41dbd6..38d60d79b 100644 --- a/library/language/source/email/topic_notify.html +++ b/library/language/source/email/topic_notify.html @@ -1,6 +1,4 @@ -Subject: Topic Reply Notification - {TOPIC_TITLE} - -Hello, +Hello, {USERNAME}! You are receiving this email because you are watching the topic, "{TOPIC_TITLE}" at {SITENAME}. This topic has received a reply since your last visit. You can use the following link to view the replies made, no more notifications will be sent until you visit the topic. diff --git a/library/language/source/email/user_activate.html b/library/language/source/email/user_activate.html index b949b6865..b4c1624f0 100644 --- a/library/language/source/email/user_activate.html +++ b/library/language/source/email/user_activate.html @@ -1,6 +1,4 @@ -Subject: Reactivate your account - -Hello {USERNAME}, +Hello, {USERNAME}! Your account on "{SITENAME}" has been deactivated, most likely due to changes made to your profile. In order to reactivate your account you must click on the link below: diff --git a/library/language/source/email/user_activate_passwd.html b/library/language/source/email/user_activate_passwd.html index debb47c9c..622a8628f 100644 --- a/library/language/source/email/user_activate_passwd.html +++ b/library/language/source/email/user_activate_passwd.html @@ -1,6 +1,4 @@ -Subject: New password activation - -Hello {USERNAME} +Hello, {USERNAME}! You are receiving this email because you have (or someone pretending to be you has) requested a new password be sent for your account on {SITENAME}. If you did not request this email then please ignore it, if you keep receiving it please contact the board administrator. diff --git a/library/language/source/email/user_welcome.html b/library/language/source/email/user_welcome.html index 782aaad5f..3e56a33a1 100644 --- a/library/language/source/email/user_welcome.html +++ b/library/language/source/email/user_welcome.html @@ -1,5 +1,3 @@ -Subject: Welcome to {SITENAME} Forums - {WELCOME_MSG} Please keep this email for your records. Your account information is as follows: diff --git a/library/language/source/email/user_welcome_inactive.html b/library/language/source/email/user_welcome_inactive.html index 013051e86..ed3736dd5 100644 --- a/library/language/source/email/user_welcome_inactive.html +++ b/library/language/source/email/user_welcome_inactive.html @@ -1,5 +1,3 @@ -Subject: Welcome to {SITENAME} Forums - {WELCOME_MSG} Please keep this email for your records. Your account information is as follows: diff --git a/library/language/source/main.php b/library/language/source/main.php index 3a48b128f..a4f90a7ef 100644 --- a/library/language/source/main.php +++ b/library/language/source/main.php @@ -379,7 +379,6 @@ $lang['DELETED'] = 'Your message has been deleted successfully.'; $lang['POLL_DELETE'] = 'Your poll has been deleted successfully.'; $lang['VOTE_CAST'] = 'Your vote has been cast.'; -$lang['TOPIC_REPLY_NOTIFICATION'] = 'Topic Reply Notification'; $lang['EMOTICONS'] = 'Emoticons'; $lang['MORE_EMOTICONS'] = 'View more Emoticons'; @@ -2817,7 +2816,7 @@ $lang['EMAILER_SUBJECT'] = [ 'GROUP_APPROVED' => 'Your request to join the user group has been granted', 'GROUP_REQUEST' => 'A request to join your user group', 'PRIVMSG_NOTIFY' => 'New private message', - 'TOPIC_NOTIFY' => 'Notification of response in the thread %s', + 'TOPIC_NOTIFY' => 'Notification of response in the thread - %s', 'USER_ACTIVATE' => 'Account reactivation', 'USER_ACTIVATE_PASSWD' => 'Confirming a new password', 'USER_WELCOME' => 'Welcome to the site %s', diff --git a/privmsg.php b/privmsg.php index 9da062a89..0db9e36bb 100644 --- a/privmsg.php +++ b/privmsg.php @@ -917,7 +917,6 @@ if ($mode == 'read') { 'USERNAME' => html_entity_decode($to_username), 'NAME_FROM' => $userdata['username'], 'MSG_SUBJECT' => html_entity_decode($privmsg_subject), - 'SITENAME' => $bb_cfg['sitename'], 'U_INBOX' => make_url(PM_URL . "?folder=inbox&mode=read&p=$privmsg_sent_id"), ]); diff --git a/src/Emailer.php b/src/Emailer.php index c146d827d..16a08ad2c 100644 --- a/src/Emailer.php +++ b/src/Emailer.php @@ -45,7 +45,7 @@ class Emailer * * @return void */ - public function set_subject(string $subject) + public function set_subject(string $subject): void { $this->subject = $subject; } @@ -58,7 +58,7 @@ class Emailer * * @return void */ - public function set_to(string $email, string $name) + public function set_to(string $email, string $name): void { $this->to = new Address($email, $name); } @@ -70,7 +70,7 @@ class Emailer * * @return void */ - public function set_reply(string $email) + public function set_reply(string $email): void { $this->reply = new Address($email); } @@ -83,7 +83,7 @@ class Emailer * * @return void */ - public function set_template(string $template_file, string $template_lang = '') + public function set_template(string $template_file, string $template_lang = ''): void { global $bb_cfg; @@ -206,7 +206,7 @@ class Emailer * * @return void */ - public function assign_vars($vars) + public function assign_vars($vars): void { global $bb_cfg;