Merged message -> email fixes from stable

This commit is contained in:
moodler 2007-08-10 05:24:31 +00:00
parent e814e7d79c
commit 4603b8d60c
2 changed files with 4 additions and 10 deletions

View File

@ -991,12 +991,11 @@ function message_post_message($userfrom, $userto, $message, $format, $messagetyp
return false;
}
/// Check to see if anything else needs to be done with it
$preference = (object)get_user_preferences(NULL, NULL, $userto->id);
if (!isset($preference->message_emailmessages) or $preference->message_emailmessages) { // Receiver wants mail forwarding
if (!isset($preference->message_emailmessages) || $preference->message_emailmessages) { // Receiver wants mail forwarding
if (!isset($preference->message_emailtimenosee)) {
$preference->message_emailtimenosee = 10;
}
@ -1024,6 +1023,9 @@ function message_post_message($userfrom, $userto, $message, $format, $messagetyp
$userto->email = $preference->message_emailaddress; // Use custom messaging address
}
email_to_user($userto, $userfrom, $messagesubject, $messagetext, $messagehtml);
debugging('Mail was sent', DEBUG_NORMAL);
echo "mail was sent";
sleep(3);
}
}

View File

@ -58,14 +58,6 @@
}
}
/// Make sure the receiving user has preferences
if (!isset($userpreferences['message_showmessagewindow'])) { // User has not used messaging before
set_user_preference('message_showmessagewindow', 1, $user->id);
set_user_preference('message_emailmessages', 1, $user->id);
set_user_preference('message_emailtimenosee', 10, $user->id);
set_user_preference('message_emailaddress', $user->email, $user->id);
}
if ($message!='' and confirm_sesskey()) { /// Current user has just sent a message