Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit fe4a0cfe6360e92a3fa14db8966fad6500873b52 1 parent d0e3447
@samhemelryk samhemelryk authored
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,
Please sign in to comment.
Something went wrong with that request. Please try again.