Skip to content

Commit

Permalink
You've Got Mail (#20162)
Browse files Browse the repository at this point in the history
* You've Got Mail

Since 2003 the internet has changed. We no longer get a message to say that we have a message. Instead we just give you the message. You probably never use the messages component (especially for private message to a specific user) as they are the equivalent of https://www.youtube.com/watch?v=gFBLiHpkcOk

The Joomla com_messages component is used in two instances

1. Notification of a new article
2. Sending a message to another user

### Current email for Notification of a new article
Subject: A new private message has arrived from [sitename]
Body:
> Please log in to [link] to read your message.

### New email for Notification of a new article
Subject: New message from [user] at [sitename]
Body:
> New Article
A new Article has been submitted by 'user' entitled 'blog post'.
> Please log in to [link] to read your message.

### Current email when sending a message to another user
Subject: A new private message has arrived from [sitename]
Body:
> Please log in to [link] to read your message.

### New email when sending a message to another user
Subject: New message from [user] at [sitename]
Body:
> [subject]
 [message]
[login link]

## Backwards Compatibility
No issues. The message contains the old login message PLUS the content of the message. So if you were using this message in a custom workflow there is no change required to that workflow

* subj

* cs

* add new string and mark existing string for deprecation
  • Loading branch information
brianteeman authored and Michael Babker committed Apr 29, 2018
1 parent 3400df5 commit 9ea7106
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
10 changes: 7 additions & 3 deletions administrator/components/com_messages/models/message.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,13 @@ public function save($data)

// Build the email subject and message
$sitename = JFactory::getApplication()->get('sitename');
$fromName = $fromUser->get('name');
$siteURL = JUri::root() . 'administrator/index.php?option=com_messages&view=message&message_id=' . $table->message_id;
$subject = sprintf($lang->_('COM_MESSAGES_NEW_MESSAGE_ARRIVED'), $sitename);
$msg = sprintf($lang->_('COM_MESSAGES_PLEASE_LOGIN'), $siteURL);
$subject = html_entity_decode($table->subject, ENT_COMPAT, 'UTF-8');
$message = strip_tags(html_entity_decode($table->message, ENT_COMPAT, 'UTF-8'));

$subj = sprintf($lang->_('COM_MESSAGES_NEW_MESSAGE'), $fromName, $sitename);
$msg = $subject . "\n\n" . $message . "\n\n" . sprintf($lang->_('COM_MESSAGES_PLEASE_LOGIN'), $siteURL);

// Send the email
$mailer = JFactory::getMailer();
Expand Down Expand Up @@ -396,7 +400,7 @@ public function save($data)
return true;
}

$mailer->setSubject($subject);
$mailer->setSubject($subj);
$mailer->setBody($msg);

// The Send method will raise an error via JError on a failure, we do not need to check it ourselves here
Expand Down
2 changes: 2 additions & 0 deletions administrator/language/en-GB/en-GB.com_messages.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ COM_MESSAGES_N_ITEMS_TRASHED="%d messages trashed."
COM_MESSAGES_N_ITEMS_TRASHED_1="Message trashed."
COM_MESSAGES_N_ITEMS_UNPUBLISHED="%d messages marked as unread."
COM_MESSAGES_N_ITEMS_UNPUBLISHED_1="Message marked as unread."
COM_MESSAGES_NEW_MESSAGE="New Message from %1$s at %2$s"
; The following string is deprecated and will be removed in Joomla 4.0
COM_MESSAGES_NEW_MESSAGE_ARRIVED="A new private message has arrived from %s"
COM_MESSAGES_NO_ITEM_SELECTED="No messages selected."
COM_MESSAGES_OPTION_READ="Read"
Expand Down
2 changes: 2 additions & 0 deletions language/en-GB/en-GB.com_messages.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
; Note : All ini files need to be saved as UTF-8

COM_MESSAGES_ERR_SEND_FAILED="The user has locked their mailbox. Message failed."
COM_MESSAGES_NEW_MESSAGE="New Message from %1$s at %2$s"
; The following string is deprecated and will be removed in Joomla 4.0
COM_MESSAGES_NEW_MESSAGE_ARRIVED="A new private message has arrived from %s"
COM_MESSAGES_PLEASE_LOGIN="Please log in to %s to read your message."

0 comments on commit 9ea7106

Please sign in to comment.