Updated Auth to have proper register - Chris it was the $val item we fixed toget…
…her; Updated tenzing.css to better show Custom Fields inside fieldsets; Update notifications to coinside with registration when user not activated
Showing
3 changed files
with
48 additions
and
19 deletions
| ... | @@ -194,6 +194,12 @@ function activate($key) { | ... | @@ -194,6 +194,12 @@ function activate($key) { |
| 194 | //add_new_user_to_blog( $id, $user_email, $meta ); | 194 | //add_new_user_to_blog( $id, $user_email, $meta ); |
| 195 | //do_action(ACTION_ACTIVATE, $id, $password, $meta); | 195 | //do_action(ACTION_ACTIVATE, $id, $password, $meta); |
| 196 | 196 | ||
| 197 | // KB001: If more than the password was sent in meta, have it generate user_meta for each key=>val pair | ||
| 198 | foreach($meta as $key=>$val) { | ||
| 199 | update_user_meta($id, $key, $val); | ||
| 200 | } | ||
| 201 | |||
| 202 | |||
| 197 | return (int)$id; | 203 | return (int)$id; |
| 198 | } | 204 | } |
| 199 | 205 | ||
| ... | @@ -205,16 +211,16 @@ class Validation extends Common\Validation { | ... | @@ -205,16 +211,16 @@ class Validation extends Common\Validation { |
| 205 | */ | 211 | */ |
| 206 | protected function username($val) { | 212 | protected function username($val) { |
| 207 | if (empty($val)) { | 213 | if (empty($val)) { |
| 208 | throw new Exception('Username is blank'); | 214 | throw new Exception('<li>Username is blank</li>'); |
| 209 | } | 215 | } |
| 210 | 216 | ||
| 211 | require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'registration.php'); | 217 | require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'registration.php'); |
| 212 | if (!validate_username($val)) { | 218 | if (!validate_username($val)) { |
| 213 | throw new Exception('Username must be at least 4 characters, letters and numbers only'); | 219 | throw new Exception('<li>Username must be at least 4 characters, letters and numbers only</li>'); |
| 214 | } | 220 | } |
| 215 | 221 | ||
| 216 | if (username_exists($_POST['reg_username'])) { | 222 | if (username_exists($val)) { |
| 217 | throw new Exception('Username already exists'); | 223 | throw new Exception('<li>Username already exists</li>'); |
| 218 | } | 224 | } |
| 219 | } | 225 | } |
| 220 | 226 | ||
| ... | @@ -224,7 +230,7 @@ class Validation extends Common\Validation { | ... | @@ -224,7 +230,7 @@ class Validation extends Common\Validation { |
| 224 | */ | 230 | */ |
| 225 | protected function password($val) { | 231 | protected function password($val) { |
| 226 | if (empty($val)) { | 232 | if (empty($val)) { |
| 227 | throw new Exception('Password can not be blank'); | 233 | throw new Exception('<li>Password can not be blank</li>'); |
| 228 | } | 234 | } |
| 229 | } | 235 | } |
| 230 | 236 | ||
| ... | @@ -234,11 +240,11 @@ class Validation extends Common\Validation { | ... | @@ -234,11 +240,11 @@ class Validation extends Common\Validation { |
| 234 | */ | 240 | */ |
| 235 | protected function email($val) { | 241 | protected function email($val) { |
| 236 | if (!(boolean)filter_var($val, FILTER_VALIDATE_EMAIL)) { | 242 | if (!(boolean)filter_var($val, FILTER_VALIDATE_EMAIL)) { |
| 237 | throw new Exception('Invalid email address'); | 243 | throw new Exception('<li>Invalid email address</li>'); |
| 238 | } | 244 | } |
| 239 | 245 | ||
| 240 | if (false !== email_exists($val)) { | 246 | if (false !== email_exists($val)) { |
| 241 | throw new Exception('Email address already registered'); | 247 | throw new Exception('<li>Email address already registered</li>'); |
| 242 | } | 248 | } |
| 243 | } | 249 | } |
| 244 | } | 250 | } | ... | ... |
| ... | @@ -98,4 +98,17 @@ border:none; | ... | @@ -98,4 +98,17 @@ border:none; |
| 98 | margin-top: -28px; | 98 | margin-top: -28px; |
| 99 | } | 99 | } |
| 100 | #TzBrandingFooter a { color:#fff; text-decoration:none; } | 100 | #TzBrandingFooter a { color:#fff; text-decoration:none; } |
| 101 | */ | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 101 | |||
| 102 | /* Post Custom Type Fields Display */ | ||
| 103 | .cct-fields { padding:10px; } | ||
| 104 | .cct-fields fieldset { margin-top:15px; border: 1px solid #ccc; padding:15px; background-color: #f2f2f2; } | ||
| 105 | .cct-fields div { clear:both; margin-top:5px; } | ||
| 106 | .cct-fields div span.label { margin-top:3px;float:left; width: 150px; margin-right:10px; margin-bottom:3px; } | ||
| 107 | .cct-fields div input[type=text], | ||
| 108 | .cct-fields div textarea { width: 300px;} | ||
| 109 | .cct-fields div textarea { height:80px;} | ||
| 110 | |||
| 111 | |||
| 112 | |||
| 113 | |||
| 114 | ... | ... |
| ... | @@ -164,11 +164,13 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), | ... | @@ -164,11 +164,13 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), |
| 164 | if($notification) { | 164 | if($notification) { |
| 165 | 165 | ||
| 166 | // get the user and user details.... | 166 | // get the user and user details.... |
| 167 | $user = new WP_User($uid);//Tools\getCurrentUser(); | 167 | if ($uid > 0) { |
| 168 | $notify_me = get_user_meta($user->ID,'notify_me',true); | 168 | $user = new WP_User($uid);//Tools\getCurrentUser(); |
| 169 | $notify_format = get_user_meta($user->ID,'notify_format',true); | 169 | $notify_me = get_user_meta($user->ID,'notify_me',true); |
| 170 | $email_preference = get_user_meta($user->ID,'email_address_preference',true); | 170 | $notify_format = get_user_meta($user->ID,'notify_format',true); |
| 171 | $cell = get_user_meta($user->ID,'home_mobile',true); | 171 | $email_preference = get_user_meta($user->ID,'email_address_preference',true); |
| 172 | $cell = get_user_meta($user->ID,'home_mobile',true); | ||
| 173 | } | ||
| 172 | 174 | ||
| 173 | // get the notification and notificatio details.... | 175 | // get the notification and notificatio details.... |
| 174 | $nid = $notification->ID; | 176 | $nid = $notification->ID; |
| ... | @@ -190,11 +192,11 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), | ... | @@ -190,11 +192,11 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), |
| 190 | 192 | ||
| 191 | 193 | ||
| 192 | // if is_sms ============================================= | 194 | // if is_sms ============================================= |
| 193 | if ($notification->is_sms && $notify_me && !empty($cell)) { | 195 | if ($notification->is_sms && isset($notify_me) && $notify_me && isset($cell) && !empty($cell)) { |
| 194 | } | 196 | } |
| 195 | 197 | ||
| 196 | // if is_system ========================================== | 198 | // if is_system ========================================== |
| 197 | if ($notification->is_system) { | 199 | if ($notification->is_system && $uid != 0) { |
| 198 | get_user_notices($user->ID); | 200 | get_user_notices($user->ID); |
| 199 | $notices = Vars::$notices; | 201 | $notices = Vars::$notices; |
| 200 | 202 | ||
| ... | @@ -215,8 +217,8 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), | ... | @@ -215,8 +217,8 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), |
| 215 | 217 | ||
| 216 | 218 | ||
| 217 | // if is_email =========================================== | 219 | // if is_email =========================================== |
| 218 | if ($notification->is_email && ($notify_me || $send_override)) { | 220 | if ($notification->is_email && ( (isset($notify_me) && $notify_me) || $send_override)) { |
| 219 | send_email($user->ID,$email,$args,$send_override); | 221 | send_email($uid,$email,$args,$send_override); |
| 220 | } | 222 | } |
| 221 | 223 | ||
| 222 | 224 | ||
| ... | @@ -230,9 +232,17 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), | ... | @@ -230,9 +232,17 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(), |
| 230 | 232 | ||
| 231 | function send_email($uid, $contents,$args) { | 233 | function send_email($uid, $contents,$args) { |
| 232 | $from_address = get_bloginfo('admin_email'); | 234 | $from_address = get_bloginfo('admin_email'); |
| 233 | $user = new WP_User($uid); | ||
| 234 | 235 | ||
| 235 | $to_email = $user->user_email; | 236 | if ($uid > 0) { |
| 237 | $user = new WP_User($uid); | ||
| 238 | $to_email = $user->user_email; | ||
| 239 | } elseif (isset($args['email']) && !empty($args['email'])) { | ||
| 240 | $to_email = $args['email']; | ||
| 241 | } else { | ||
| 242 | return; | ||
| 243 | } | ||
| 244 | |||
| 245 | |||
| 236 | $subject = $contents['subject']; | 246 | $subject = $contents['subject']; |
| 237 | $html = $contents['html']; | 247 | $html = $contents['html']; |
| 238 | $alttext = $contents['text']; | 248 | $alttext = $contents['text']; | ... | ... |
-
Please register or sign in to post a comment