fb9eaa6c by Jeff Balicki

changed email_address_preference

1 parent 061641c1
...@@ -87,18 +87,11 @@ function print_user_notices($showOnlyUnread = false) ...@@ -87,18 +87,11 @@ function print_user_notices($showOnlyUnread = false)
87 $system = get_post_meta($notice['notification_id'], 'system', true); 87 $system = get_post_meta($notice['notification_id'], 'system', true);
88 $content = ''; 88 $content = '';
89 if (!isset($notice['message']) && in_array($triggered, $enableTriggers)) { 89 if (!isset($notice['message']) && in_array($triggered, $enableTriggers)) {
90 $emailAddressPreference = get_user_meta($user->ID, 'email_address_preference', true); 90 $pp = strtolower(get_user_meta($user->ID, 'profile_preference', true)) . "_";
91 if (empty($emailAddressPreference)) { 91 $toEmail = get_user_meta($user->ID, $pp . "email", true);
92 $userData = get_userdata($user->ID);
93 $toEmail = $userData->user_email;
94 } else {
95 $pp = strtolower($emailAddressPreference) . '_';
96 $toEmail = get_user_meta($user->ID, $pp . 'email', true);
97 92
98 if (empty($toEmail)) { 93 if (empty($toEmail)) {
99 $userData = get_userdata($user->ID); 94 $toEmail = $user->user_email;
100 $toEmail = $userData->user_email;
101 }
102 } 95 }
103 96
104 $message = ''; 97 $message = '';
...@@ -420,17 +413,13 @@ function send_triggered_notification($uid = 0, $trigger = 'NO_TRIGGER', $args = ...@@ -420,17 +413,13 @@ function send_triggered_notification($uid = 0, $trigger = 'NO_TRIGGER', $args =
420 } elseif ($uid == 0 && isset($args['email'])) { 413 } elseif ($uid == 0 && isset($args['email'])) {
421 $toEmail = $args['email']; 414 $toEmail = $args['email'];
422 } else { 415 } else {
423 $emailAddressPreference = get_user_meta($user->ID, 'email_address_preference', true); 416 $pp = strtolower(get_user_meta($user->ID, 'profile_preference', true)) . "_";
424 if (empty($emailAddressPreference)) { 417 $toEmail = get_user_meta($user->ID, $pp . "email", true);
425 $toEmail = $user->user_email;
426 } else {
427 $pp = strtolower($emailAddressPreference) . '_';
428 $toEmail = get_user_meta($user->ID, $pp . 'email', true);
429 418
430 if (empty($toEmail)) { 419 if (empty($toEmail)) {
431 $toEmail = $user->user_email; 420 $toEmail = $user->user_email;
432 }
433 } 421 }
422
434 } 423 }
435 424
436 $contents = $email; 425 $contents = $email;
......