Update Profile Email

This topic contains 3 reply and 2 voices, and was last updated by Tareq Hasan 10 years, 6 months ago
Viewing 3 Posts - 1 through 3 (of 3 total)
Author Posts
October 28, 2013 at 9:24 pm 9508
Tareq Hasan It's possible to verify if email is in use when a user update email profile? I would like it to appear an error message and the form was not sent. I think I can do with action hook field...how?? Suggestions?
October 29, 2013 at 3:08 am 9525
Tareq Hasan Tareq Hasan

Sorry, currently that wouldn’t be possible as there isn’t any validation filter available for the profile update.

October 29, 2013 at 4:25 pm 9560
Gian Mauro Gian Mauro

What do you think of this solution? If email exists I reset this and I write old email. there is a way to cancel the form-post and / or return a custom error message??

function my_verify_and_reset_email($user_data) {
	if (isset($_POST['user_email'])) {
		$user_info = get_userdata($user_data['ID']);
		$old_email = $user_info->user_email;
		if(email_exists($_POST['user_email'])) {			
			$user_data['user_email'] = $old_email;
		}        
    }
	return $user_data;
}
add_filter('wpuf_update_profile_vars', 'my_verify_and_reset_email');
October 29, 2013 at 5:34 pm 9565
Tareq Hasan Tareq Hasan

If the solution works for you, thats definitely good. But as I said, your can’t stop the form post and show an error as there isn’t any validation filter available for updating user profile.

Viewing 3 Posts - 1 through 3 (of 3 total)