From d28642a657dbe9ad13fbd8ea88bdaefb568fd8c4 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 25 Jun 2025 18:09:48 +0300 Subject: [PATCH] Fix email validation logic in Ultimate Member forms Updated the condition to ensure proper validation for secondary email fields. This change ensures unique email addresses and prevents potential conflicts in user data. --- includes/core/um-actions-form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/core/um-actions-form.php b/includes/core/um-actions-form.php index b79f25da..a76d8de9 100644 --- a/includes/core/um-actions-form.php +++ b/includes/core/um-actions-form.php @@ -943,7 +943,7 @@ function um_submit_form_errors_hook_( $submitted_data, $form_data ) { UM()->form()->add_error( $key, __( 'The email you entered is incorrect', 'ultimate-member' ) ); } elseif ( 'secondary_user_email' === $key && ! empty( $submitted_data[ $key ] ) && ! empty( $submitted_data['user_email'] ) && $submitted_data[ $key ] === $submitted_data['user_email'] ) { UM()->form()->add_error( $key, __( 'The secondary email cannot be the same as primary', 'ultimate-member' ) ); - } else { + } elseif ( ! empty( $submitted_data[ $key ] ) ) { // There we have valid and unique user_email. But need to check in usermeta table for other users. $args = array( 'meta_query' => array(