4f4cd750 by Kevin Burton

updated notification file to allow email address to be passed through args if new register

1 parent 37b90785
...@@ -488,7 +488,7 @@ input.dp-applied { ...@@ -488,7 +488,7 @@ input.dp-applied {
488 .cbv-report-list tbody td { text-align:left; font-size: 11px; word-wrap: normal; padding: 3px 5px; } 488 .cbv-report-list tbody td { text-align:left; font-size: 11px; word-wrap: normal; padding: 3px 5px; }
489 .cbv-report-list tbody tr.odd td { background-color: #f5f5f5; } 489 .cbv-report-list tbody tr.odd td { background-color: #f5f5f5; }
490 .cbv-report-list thead th { background-color: #e1e1e1;border-bottom:1px solid #e8e8e8; } 490 .cbv-report-list thead th { background-color: #e1e1e1;border-bottom:1px solid #e8e8e8; }
491 .cbv-report-list tbody td { border-bottom:1px solid #e8e8e8; min-width: 120px;} 491 .cbv-report-list tbody td { border-bottom:1px solid #e8e8e8; min-width: 120px; background-color:#fff;}
492 492
493 #user-list-from { display: block; } 493 #user-list-from { display: block; }
494 494
......
1 <?php 1 <?php
2 namespace Tz\WordPress\Tools\MySQLTable; 2 namespace Tz\WordPress\Tools\MySQLTable;
3 3
4 function array2table($arr,$width) 4 function array2table($arr,$width = "100%")
5 { 5 {
6 $count = count($arr); 6 $count = count($arr);
7 if($count > 0){ 7 if($count > 0){
......
...@@ -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;
......