only use WP user_email in User Admin Functionality
Showing
4 changed files
with
17 additions
and
4 deletions
| ... | @@ -237,7 +237,11 @@ class ProfileValidation extends Common\Validation { | ... | @@ -237,7 +237,11 @@ class ProfileValidation extends Common\Validation { |
| 237 | } else { | 237 | } else { |
| 238 | throw new Exception('Email field can not be empty'); | 238 | throw new Exception('Email field can not be empty'); |
| 239 | } | 239 | } |
| 240 | update_user_meta($_POST['uid'], 'email', $val); | 240 | |
| 241 | // update user email. | ||
| 242 | wp_update_user( Array ('ID'=>$_POST['uid'] , 'user_email'=>$val) ); | ||
| 243 | |||
| 244 | //update_user_meta($_POST['uid'], 'email', $val); | ||
| 241 | } | 245 | } |
| 242 | 246 | ||
| 243 | public function company($val) { | 247 | public function company($val) { |
| ... | @@ -408,6 +412,7 @@ class Actions { | ... | @@ -408,6 +412,7 @@ class Actions { |
| 408 | , 'country' => $_POST['country'] | 412 | , 'country' => $_POST['country'] |
| 409 | , 'email' => $email | 413 | , 'email' => $email |
| 410 | ); | 414 | ); |
| 415 | unset($user_details['email']); | ||
| 411 | 416 | ||
| 412 | if (isset($_POST['member_id'])) { $user_details['member_id'] = $_POST['member_id']; } | 417 | if (isset($_POST['member_id'])) { $user_details['member_id'] = $_POST['member_id']; } |
| 413 | $user_details = array_merge(User\Vars::$meta_defaults, $user_details); | 418 | $user_details = array_merge(User\Vars::$meta_defaults, $user_details); | ... | ... |
| ... | @@ -13,6 +13,14 @@ use Exception, StdClass; | ... | @@ -13,6 +13,14 @@ use Exception, StdClass; |
| 13 | use WP_User; | 13 | use WP_User; |
| 14 | 14 | ||
| 15 | $user = new WP_User($_GET['uid']); | 15 | $user = new WP_User($_GET['uid']); |
| 16 | |||
| 17 | /* | ||
| 18 | print "<pre>"; | ||
| 19 | print_r($user); | ||
| 20 | print "</pre>"; | ||
| 21 | */ | ||
| 22 | |||
| 23 | |||
| 16 | reset($user->roles); | 24 | reset($user->roles); |
| 17 | $role = current($user->roles); | 25 | $role = current($user->roles); |
| 18 | 26 | ... | ... |
| ... | @@ -29,7 +29,7 @@ $country = get_user_meta($uid, 'country', true); | ... | @@ -29,7 +29,7 @@ $country = get_user_meta($uid, 'country', true); |
| 29 | $phone = get_user_meta($uid, 'phone', true); | 29 | $phone = get_user_meta($uid, 'phone', true); |
| 30 | $fax = get_user_meta($uid, 'fax', true); | 30 | $fax = get_user_meta($uid, 'fax', true); |
| 31 | $mobile = get_user_meta($uid, 'mobile', true); | 31 | $mobile = get_user_meta($uid, 'mobile', true); |
| 32 | $email = get_user_meta($uid, 'email', true); | 32 | $email = $user->user_email;//get_user_meta($uid, 'email', true); |
| 33 | 33 | ||
| 34 | // professional stuff | 34 | // professional stuff |
| 35 | $title = get_user_meta($uid, 'title', true); | 35 | $title = get_user_meta($uid, 'title', true); | ... | ... |
| ... | @@ -134,7 +134,7 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true); | ... | @@ -134,7 +134,7 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true); |
| 134 | </tr> | 134 | </tr> |
| 135 | <tr> | 135 | <tr> |
| 136 | <th>Email:</th> | 136 | <th>Email:</th> |
| 137 | <td><input type="text" name="email" value="<?php echo get_user_meta($_GET['uid'], 'email', true);?>" /></td> | 137 | <td><input type="text" name="email" value="<?php echo $user->user_email;?>" /></td> |
| 138 | </tr> | 138 | </tr> |
| 139 | <tr> | 139 | <tr> |
| 140 | <th>Mobile:</th> | 140 | <th>Mobile:</th> |
| ... | @@ -157,7 +157,7 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true); | ... | @@ -157,7 +157,7 @@ $preference = get_user_meta($user->ID, 'email_address_preference', true); |
| 157 | <td> | 157 | <td> |
| 158 | <select name="email_address_preference"> | 158 | <select name="email_address_preference"> |
| 159 | <?php | 159 | <?php |
| 160 | $email = get_user_meta($_GET['uid'],'email',true); | 160 | $email = $user->user_email; |
| 161 | ?> | 161 | ?> |
| 162 | <option value="none" <?php echo ($preference=="none") ? "selected" : "";?>>None</option> | 162 | <option value="none" <?php echo ($preference=="none") ? "selected" : "";?>>None</option> |
| 163 | <?php if(!empty($email)): ?><option value="email" <?php echo ($preference=="email") ? "selected" : "";?>><?php echo $email;?></option><?php endif;?> | 163 | <?php if(!empty($email)): ?><option value="email" <?php echo ($preference=="email") ? "selected" : "";?>><?php echo $email;?></option><?php endif;?> | ... | ... |
-
Please register or sign in to post a comment