• Resolved joeltron1

    (@joeltron1)


    Been battling with this for a few hours and would LOVE some help.

    Signing-up seems to work fine for most emails, but some error and say “Email already exists”. The emails are not in use on any of my multi-sites, however may be registered with www.remarpro.com

    I have tried commenting out the validation code which displays its been submitted, however doesn’t create the user.

Viewing 1 replies (of 1 total)
  • Thread Starter joeltron1

    (@joeltron1)

    So I think I managed to get it to work by reworking the validation function in includes/form/class-ur-form-field-user-email.php to the following.

           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' );
                                            }
                                    );
                    }
            }
    
Viewing 1 replies (of 1 total)
  • The topic ‘“Email already exists.” on sign-up, however no user is registered’ is closed to new replies.