Browse files

PULL-574 MDL-26185 Reverted changes due failed testing + review

  • Loading branch information...
1 parent d0e3447 commit fe4a0cfe6360e92a3fa14db8966fad6500873b52 Sam Hemelryk committed Apr 6, 2011
Showing with 10 additions and 3 deletions.
  1. +10 −3 message/output/email/message_output_email.php
View
13 message/output/email/message_output_email.php
@@ -46,10 +46,17 @@ function send_message($eventdata) {
return true;
}
+ //hold onto email preference because /admin/cron.php sends a lot of messages at once
+ static $useremailaddresses = array();
+
//check user preference for where user wants email sent
- $preferedemail = get_user_preferences('message_processor_email_email', null, $eventdata->userto->id);
- if (!empty($preferedemail)) {
- $eventdata->userto->email = $preferedemail;
+ if (!array_key_exists($eventdata->userto->id, $useremailaddresses)) {
+ $useremailaddresses[$eventdata->userto->id] = get_user_preferences('message_processor_email_email', $eventdata->userto->email, $eventdata->userto->id);
+ }
+ $usertoemailaddress = $useremailaddresses[$eventdata->userto->id];
+
+ if ( !empty($usertoemailaddress)) {
+ $userto->email = $usertoemailaddress;
}
$result = email_to_user($eventdata->userto, $eventdata->userfrom,

0 comments on commit fe4a0cf

Please sign in to comment.