6d926b3a by Kevin Burton

updated notifications and user manager

1 parent 4a6e546c
......@@ -368,8 +368,8 @@ class Vars {
public static $notices;
public static $options;
public static $field_lookup = array(
'current_user' => "Current Logged-in User"
, 'allusers' => "All Users"
'allusers' => "All Users"
, 'report' => "Report"
);
}
?>
\ No newline at end of file
......
......@@ -228,8 +228,10 @@ class ProfileValidation extends Common\Validation {
}
public function home_province($val) {
if (empty($val)) {
throw new Exception('Province field can not be empty');
if ( $_POST['profile_preference']=="Home" ) {
if (empty($val)) {
throw new Exception('Home Province field can not be empty');
}
}
update_user_meta($_POST['uid'], __FUNCTION__, $val);
}
......@@ -239,8 +241,10 @@ class ProfileValidation extends Common\Validation {
}
public function home_country($val) {
if (empty($val)) {
throw new Exception('Country field can not be empty');
if ( $_POST['profile_preference']=="Home" ) {
if (empty($val)) {
throw new Exception('Home Country field can not be empty');
}
}
update_user_meta($_POST['uid'], __FUNCTION__, $val);
}
......@@ -262,7 +266,7 @@ class ProfileValidation extends Common\Validation {
}
if ($_POST['profile_preference']=="Home") {
wp_update_user( Array ('ID'=>$_POST['uid'] , 'user_email'=>$val) );
_update_user( Array ('ID'=>$_POST['uid'] , 'user_email'=>$val) );
}
update_user_meta($_POST['uid'], 'home_email', $val);
......@@ -281,8 +285,10 @@ class ProfileValidation extends Common\Validation {
}
public function work_province($val) {
if (empty($val)) {
throw new Exception('Province field can not be empty');
if ($_POST['profile_preference']=="Work") {
if (empty($val)) {
throw new Exception('Work Province field can not be empty');
}
}
update_user_meta($_POST['uid'], __FUNCTION__, $val);
}
......@@ -292,8 +298,10 @@ class ProfileValidation extends Common\Validation {
}
public function work_country($val) {
if (empty($val)) {
throw new Exception('Country field can not be empty');
if ($_POST['profile_preference']=="Work") {
if (empty($val)) {
throw new Exception('Work Country field can not be empty');
}
}
update_user_meta($_POST['uid'], __FUNCTION__, $val);
}
......@@ -315,7 +323,7 @@ class ProfileValidation extends Common\Validation {
}
if ($_POST['profile_preference']=="Work") {
wp_update_user( Array ('ID'=>$_POST['uid'] , 'user_email'=>$val) );
_update_user( Array ('ID'=>$_POST['uid'] , 'user_email'=>$val) );
}
update_user_meta($_POST['uid'], 'work_email', $val);
......
......@@ -162,7 +162,7 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true);
<table cellpadding="0" cellspacing="0" border="0" class="my-profile-table">
<tbody>
<tr>
<td colspan="2"><input type="radio" name="profile_preference" value="Home" <?php echo (get_user_meta($_GET['uid'], 'profile_preference', true) == "Work") ? "checked='checked'" : ""; ?> />&nbsp;<em>Preferred</em> contact method.</td>
<td colspan="2"><input type="radio" name="profile_preference" value="Work" <?php echo (get_user_meta($_GET['uid'], 'profile_preference', true) == "Work") ? "checked='checked'" : ""; ?> />&nbsp;<em>Preferred</em> contact method.</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr class="work-only">
......