merged 220 into tag
Showing
1 changed file
with
18 additions
and
12 deletions
| ... | @@ -187,7 +187,7 @@ function remove_notice($notification_id = -1) { | ... | @@ -187,7 +187,7 @@ function remove_notice($notification_id = -1) { |
| 187 | Send Notifications | 187 | Send Notifications |
| 188 | @trigger = notification unique slug name | 188 | @trigger = notification unique slug name |
| 189 | */ | 189 | */ |
| 190 | function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),$send_override = false) { | 190 | function send_triggered_notification($uid = 0,$trigger="NO_TRIGGER",$args = array(),$send_override = false) { |
| 191 | global $wpdb; | 191 | global $wpdb; |
| 192 | $notification = get_notification_by_trigger($trigger); | 192 | $notification = get_notification_by_trigger($trigger); |
| 193 | 193 | ||
| ... | @@ -231,19 +231,25 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), | ... | @@ -231,19 +231,25 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), |
| 231 | // if is_email =========================================== | 231 | // if is_email =========================================== |
| 232 | if ($notification->is_email) { | 232 | if ($notification->is_email) { |
| 233 | 233 | ||
| 234 | $user = new User\Account($uid); | 234 | if ($uid == 0 && !isset($args['email'])) { |
| 235 | 235 | return; | |
| 236 | $email_address_preference = get_user_meta($user->ID, 'email_address_preference', true); | 236 | } elseif ( $uid == 0 && isset($args['email']) ) { |
| 237 | if (empty($email_address_preference)) { | 237 | $to_email = $args['email']; |
| 238 | $to_email = $user->user_email; | ||
| 239 | } else { | 238 | } else { |
| 240 | 239 | ||
| 241 | $pp = strtolower($email_address_preference)."_"; | 240 | $user = new User\Account($uid); |
| 242 | $to_email = get_user_meta($user->ID, $pp.'email', true); | 241 | $email_address_preference = get_user_meta($user->ID, 'email_address_preference', true); |
| 243 | 242 | if (empty($email_address_preference)) { | |
| 244 | if (empty($to_email)) { | ||
| 245 | $to_email = $user->user_email; | 243 | $to_email = $user->user_email; |
| 246 | } | 244 | } else { |
| 245 | |||
| 246 | $pp = strtolower($email_address_preference)."_"; | ||
| 247 | $to_email = get_user_meta($user->ID, $pp.'email', true); | ||
| 248 | |||
| 249 | if (empty($to_email)) { | ||
| 250 | $to_email = $user->user_email; | ||
| 251 | } | ||
| 252 | } | ||
| 247 | } | 253 | } |
| 248 | 254 | ||
| 249 | $contents = $email; | 255 | $contents = $email; | ... | ... |
-
Please register or sign in to post a comment