• Resolved cbakes

    (@cbakes)


    I have created a registration form which seems to work properly. However the Login page for users which contains the fields ‘User Email’ and ‘Password’ comes up with the message ‘Email already exists’ and so nobody can login.
    How do I fix this?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Saroj Shah

    (@wpeverestsupportrep)

    Hi @cbakes

    Thanks for writing in,

    Please go to:
    user-registration/includes/form/class-ur-form-field-user-email.php
    and replace the lines from 50 t0 73 with the following code.

    public function validation( $single_form_field, $form_data, $filter_hook, $form_id ) {
    
                    $email  = isset( $form_data->value ) ? $form_data->value : '';
                    $status = is_email( $email );
    
                    if ( email_exists( $email ) ) {
    
                             // On multisite, ensure user exists on current site
                            if ( is_multisite() ) {
                                    // assign user to blog and set their status to pending 
                                    $user_data = get_user_by( 'email', $email ); 
                                    if ( $user_data && ! is_user_member_of_blog( $user_data->ID, get_current_blog_id() ) ) {
                     
                                            add_user_to_blog( get_current_blog_id(), $user_data->ID, 'customer' );
                                            
                                            $user_manager = new UR_Admin_User_Manager( $user_data->ID );
                                            $user_manager->save_status( $status, $alert_user=false );
                                    
                                    } else {
                                            $error='Email alaredy exists on this site.';
                                    }
                             } else {
                                    $error='Email alaredy exists.';
                            }
    
                            if($error)
                                    add_filter(
                                            $filter_hook,
                                            function ( $msg ) {
                                                    return __( $error, 'user-registration' );
                                            }
                                    );
                    }
            }

    I hope this helps. Please let us know if you have any issues.

    Thanks!

    Saroj Shah

    (@wpeverestsupportrep)

    Hi @cbakes

    Since I haven’t heard from you from few days, I am going to mark this ticket as Resolved. Please let me know if you have any questions.

    Regards!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘User Login’ is closed to new replies.