• Resolved annunto

    (@annunto)


    Hello Team
    I hope you are doing well

    I am encountering the following issue with the email field :

    1- When user email is already registered – *Error display is: The email you entered is incorrect*
    This is not good, it should rather display *email is already registered*

    2- When user enter a correct an incorrect email , then the same error is correct The email you entered is incorrect*

    If i am understanding , email validation , work two types , one for already registered email and second for incorrect email.

    To understand my issue please use the link – https://newtemplate.goodharvestltd.com/register-2/, enter the email [email protected] (this is an email address already registered) see what error it gives when click on Register.

    Can you please help me solve it out , even with the custom code.

    Thank you team

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @annunto

    The reason we changed the text is that hackers may guess the email addresses on your site.

    You can use the following Code Snippet to change the text:

    add_filter('um_submit_form_error','um_012822_unique_email_error', 10, 2 );
    function um_012822_unique_email_error( $error, $key ){
    
        if( "user_email" == $key && um_is_core_page("register") && "The email you entered is incorrect" == $error ){
           return __("Email is already registered","ultimate-member");
        }
    
        return $error;
    }

    Regards,

    Thread Starter annunto

    (@annunto)

    Hello @champsupertramp
    I hope you are fine

    Thank you for the explanation , i am inserting the code right now.

    i will inform you , if all is good.

    Thank you

    Best Regards
    Heman

    Thread Starter annunto

    (@annunto)

    Hello @champsupertramp
    I have just insert the code :

    1- When i use the an already registered , the error display is Email is already registered (This is good)

    2- When i enter an incorrect email , example hemanannuntogmail.com , it is saying Email is already registered ( it should rather say , incorrect email)

    Please – check it on https://newtemplate.goodharvestltd.com/register-2/

    Can you please advised me , what can be do ?

    Thanks
    Best Regards

    Thread Starter annunto

    (@annunto)

    Hello @missveronicatv

    Thanks , i am checking it

    i will inform you once i completely the test.

    Thank you

    Best Regards

    Thread Starter annunto

    (@annunto)

    Hello @missveronicatv

    I have just insert the code in a Snippet , unfortunately , i am have same error validation , The email you entered is incorrect , when email already registered and email is incorrect.

    Thanks

    Best Regards

    @annunto

    The code snippet will reject new registrations with invalid email addresses and already registered bad email addresses you can’t have the code snippet active when doing an update.

    Your email address hemanannuntogmail.com should be rejected if you try to register with this email again and with this code snippet active.

    • This reply was modified 3 years, 1 month ago by missveronica.
    Thread Starter annunto

    (@annunto)

    @missveronicatv

    Can you please advised if the following can be done :

    1- When user email is already registered – *Error display is: The email you entered is incorrect*
    This is not good, it should rather display email is already registered

    2- When user enter an incorrect email , then the same error is correct The email you entered is incorrect

    @annunto

    You have two different code snippets which together will solve your issues:

    1. Use the code snippet supplied by @champsupertramp

    2. Use the second code snippet to reject invalid email addresses for registration or email change. Without this code snippet invalid email addresses can be registered.

    Thread Starter annunto

    (@annunto)

    Hello @missveronicatv

    Thank you for the explanation , i was bit a lost.

    I will check it.

    I will inform you , once i completed.

    Thank you very much for the help.
    Really appreciate

    Best Regards

    Thread Starter annunto

    (@annunto)

    Hello @missveronicatv

    //** email already registered **//
    
    add_filter('um_submit_form_error','um_012822_unique_email_error', 10, 2 );
    function um_012822_unique_email_error( $error, $key ){
    
        if( "user_email" == $key && um_is_core_page("register") && "The email you entered is incorrect" == $error ){
           return __("Email is already registered","ultimate-member");
        }
    
        return $error;
    }
    //** invalid email **//
    
    add_filter( 'is_email', 'is_email_filter_validate', 10, 3 );
    
        function is_email_filter_validate( $email, $raw_email, $bool ) {
            
            return filter_var( $raw_email, FILTER_VALIDATE_EMAIL );
        }

    I have just insert the above code in Snippet , it is unfortunately , giving me error – Email is already registered for both a registered email and incorrect email insert

    @annunto

    Yes I understand your issues with the first code snippet.

    New solution:

    In the UM Forms Designer change in the Registration Form the email field:

    Set Validate to Custom Validation
    and Custom Action to user_email_details

    Replace the first code snippet with this code snippet:

    add_action('um_custom_field_validation_user_email_details','um_custom_validate_user_email_details', 999, 3);
    
    function um_custom_validate_user_email_details( $key, $array, $args ) {
    
        if ( $key == 'user_email' && isset( $args['user_email'] )) {
    
            if ( $args['user_email'] == '' ) {
                UM()->form()->add_error( 'user_email', __( 'You must provide an email', 'ultimate-member' ) );
            } elseif ( !is_email( $args['user_email'] ) ) {
                UM()->form()->add_error( 'user_email', __( 'The email you entered is invalid', 'ultimate-member' ) );
            } elseif ( email_exists( $args['user_email'] ) ) {
                UM()->form()->add_error( 'user_email', __( 'The email you entered is already registered', 'ultimate-member' ) );
            }
        }
    }
    Thread Starter annunto

    (@annunto)

    Hello @missveronicatv

    I have just test it , it is working great.

    Thank you very very much.

    Best Regards

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Thanks for letting us know how @missveronicatv solutions resolved the issue.

    Regards,

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Ultimate member [Field Email in Registration form]’ is closed to new replies.