This modification allows delivery of the message text straight into user's email, similar to facebook.
| 1 |
Open include/functions_email.php and find function "send_message" (around line 492)
Replace function declaration
function send_message($touser, $sender) {
with
function send_message($touser, $sender, $msg_subject = null, $msg_body = null) {
|
| 2 |
Find the following block
// REPLACE VARIABLES IN EMAIL SUBJECT AND MESSAGE
$subject = str_replace("[username]", $touser->user_info[user_username], $subject);
$message = str_replace("[username]", $touser->user_info[user_username], $message);
$subject = str_replace("[sender]", $sender, $subject);
$message = str_replace("[sender]", $sender, $message);
$subject = str_replace("[link]", "<a href=\"$prefix"."login.php\">$prefix"."login.php</a>", $subject);
$message = str_replace("[link]", "<a href=\"$prefix"."login.php\">$prefix"."login.php</a>", $message);
and add right after it
if(!empty($msg_body) && !empty($msg_subject)) {
$msg_subject = "\n" . str_repeat("-", 10) . "\n\n" . $msg_subject;
$message = str_replace("[msg_subject]", $msg_subject, $message );
$message = str_replace("[msg_body]", $msg_body . "\n", $message );
} else {
$message = str_replace("[msg_subject]", "", $message );
$message = str_replace("[msg_body]", "", $message );
}
|
| 3 |
Open include/class_user.php and find function "user_message_send", (around line 1508)
Find the following block (around line 1542) // SEND MESSAGE NOTIFICATION EMAIL send_message($to_user, $this->user_info[user_username]); and replace it with // SEND MESSAGE NOTIFICATION EMAIL send_message($to_user, $this->user_info[user_username], $subject, $message ); |
| 4 |
Edit "New Message Email" template in System emails, and add [msg_subject] and [msg_body] fields for the message template to look like this:
Hello [username], You have just received a new message from [sender]. Please click the following link to login and view it: [link] [msg_subject] [msg_body] Best Regards, Social Network Administration |