merged 220 into tag
Showing
1 changed file
with
8 additions
and
2 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,8 +231,13 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), | ... | @@ -231,8 +231,13 @@ 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 | return; | ||
| 236 | } elseif ( $uid == 0 && isset($args['email']) ) { | ||
| 237 | $to_email = $args['email']; | ||
| 238 | } else { | ||
| 235 | 239 | ||
| 240 | $user = new User\Account($uid); | ||
| 236 | $email_address_preference = get_user_meta($user->ID, 'email_address_preference', true); | 241 | $email_address_preference = get_user_meta($user->ID, 'email_address_preference', true); |
| 237 | if (empty($email_address_preference)) { | 242 | if (empty($email_address_preference)) { |
| 238 | $to_email = $user->user_email; | 243 | $to_email = $user->user_email; |
| ... | @@ -245,6 +250,7 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), | ... | @@ -245,6 +250,7 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), |
| 245 | $to_email = $user->user_email; | 250 | $to_email = $user->user_email; |
| 246 | } | 251 | } |
| 247 | } | 252 | } |
| 253 | } | ||
| 248 | 254 | ||
| 249 | $contents = $email; | 255 | $contents = $email; |
| 250 | 256 | ... | ... |
-
Please register or sign in to post a comment