d7ce04a1 by Kevin Burton

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
1 parent 3a8f7bff
......@@ -194,6 +194,12 @@ function activate($key) {
//add_new_user_to_blog( $id, $user_email, $meta );
//do_action(ACTION_ACTIVATE, $id, $password, $meta);
// KB001: If more than the password was sent in meta, have it generate user_meta for each key=>val pair
foreach($meta as $key=>$val) {
update_user_meta($id, $key, $val);
}
return (int)$id;
}
......@@ -205,16 +211,16 @@ class Validation extends Common\Validation {
*/
protected function username($val) {
if (empty($val)) {
throw new Exception('Username is blank');
throw new Exception('<li>Username is blank</li>');
}
require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'registration.php');
if (!validate_username($val)) {
throw new Exception('Username must be at least 4 characters, letters and numbers only');
throw new Exception('<li>Username must be at least 4 characters, letters and numbers only</li>');
}
if (username_exists($_POST['reg_username'])) {
throw new Exception('Username already exists');
if (username_exists($val)) {
throw new Exception('<li>Username already exists</li>');
}
}
......@@ -224,7 +230,7 @@ class Validation extends Common\Validation {
*/
protected function password($val) {
if (empty($val)) {
throw new Exception('Password can not be blank');
throw new Exception('<li>Password can not be blank</li>');
}
}
......@@ -234,11 +240,11 @@ class Validation extends Common\Validation {
*/
protected function email($val) {
if (!(boolean)filter_var($val, FILTER_VALIDATE_EMAIL)) {
throw new Exception('Invalid email address');
throw new Exception('<li>Invalid email address</li>');
}
if (false !== email_exists($val)) {
throw new Exception('Email address already registered');
throw new Exception('<li>Email address already registered</li>');
}
}
}
......
......@@ -98,4 +98,17 @@ border:none;
margin-top: -28px;
}
#TzBrandingFooter a { color:#fff; text-decoration:none; }
*/
\ No newline at end of file
/* Post Custom Type Fields Display */
.cct-fields { padding:10px; }
.cct-fields fieldset { margin-top:15px; border: 1px solid #ccc; padding:15px; background-color: #f2f2f2; }
.cct-fields div { clear:both; margin-top:5px; }
.cct-fields div span.label { margin-top:3px;float:left; width: 150px; margin-right:10px; margin-bottom:3px; }
.cct-fields div input[type=text],
.cct-fields div textarea { width: 300px;}
.cct-fields div textarea { height:80px;}
......
......@@ -164,11 +164,13 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),
if($notification) {
// get the user and user details....
$user = new WP_User($uid);//Tools\getCurrentUser();
$notify_me = get_user_meta($user->ID,'notify_me',true);
$notify_format = get_user_meta($user->ID,'notify_format',true);
$email_preference = get_user_meta($user->ID,'email_address_preference',true);
$cell = get_user_meta($user->ID,'home_mobile',true);
if ($uid > 0) {
$user = new WP_User($uid);//Tools\getCurrentUser();
$notify_me = get_user_meta($user->ID,'notify_me',true);
$notify_format = get_user_meta($user->ID,'notify_format',true);
$email_preference = get_user_meta($user->ID,'email_address_preference',true);
$cell = get_user_meta($user->ID,'home_mobile',true);
}
// get the notification and notificatio details....
$nid = $notification->ID;
......@@ -190,11 +192,11 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),
// if is_sms =============================================
if ($notification->is_sms && $notify_me && !empty($cell)) {
if ($notification->is_sms && isset($notify_me) && $notify_me && isset($cell) && !empty($cell)) {
}
// if is_system ==========================================
if ($notification->is_system) {
if ($notification->is_system && $uid != 0) {
get_user_notices($user->ID);
$notices = Vars::$notices;
......@@ -215,8 +217,8 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),
// if is_email ===========================================
if ($notification->is_email && ($notify_me || $send_override)) {
send_email($user->ID,$email,$args,$send_override);
if ($notification->is_email && ( (isset($notify_me) && $notify_me) || $send_override)) {
send_email($uid,$email,$args,$send_override);
}
......@@ -230,9 +232,17 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),
function send_email($uid, $contents,$args) {
$from_address = get_bloginfo('admin_email');
$user = new WP_User($uid);
$to_email = $user->user_email;
if ($uid > 0) {
$user = new WP_User($uid);
$to_email = $user->user_email;
} elseif (isset($args['email']) && !empty($args['email'])) {
$to_email = $args['email'];
} else {
return;
}
$subject = $contents['subject'];
$html = $contents['html'];
$alttext = $contents['text'];
......