From b8bd4390ac1f9e99f32ccf7fe7a846b58a030f83 Mon Sep 17 00:00:00 2001 From: Champ Camba Date: Tue, 22 Nov 2016 16:20:12 +0800 Subject: [PATCH] Fix change email address in edit mode --- core/um-actions-form.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/um-actions-form.php b/core/um-actions-form.php index 0418b5bb..f1e6d6d2 100644 --- a/core/um-actions-form.php +++ b/core/um-actions-form.php @@ -389,11 +389,13 @@ $args['user_id'] = um_get_requested_user(); } + $email_exists = email_exists( $args[$key] ); + if ( $args[$key] == '' && in_array( $key, array('user_email') ) ) { $ultimatemember->form->add_error($key, __('You must provide your email','ultimatemember') ); - } else if ( in_array( $mode, array('register') ) && email_exists( $args[$key] ) ) { + } else if ( in_array( $mode, array('register') ) && $email_exists ) { $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') ); - } else if ( in_array( $mode, array('profile') ) && email_exists( $args[$key] ) != $args['user_id'] ) { + } else if ( in_array( $mode, array('profile') ) && $email_exists && $email_exists != $args['user_id'] ) { $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') ); } else if ( !is_email( $args[$key] ) ) { $ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );