0

I am using child theme and I am replacing the base action for registering a user in my child theme:

add_action( 'wp_ajax_nopriv_parent_theme_ajax_register_form', 
            'parent_theme_ajax_register_form' );

add_action( 'wp_ajax_parent_theme_ajax_register_form', 
            'child_theme_ajax_register_form' );

if( !function_exists('child_theme_ajax_register_form') ){
    var_dump($user_name);
    var_dump($user_email);
    var_dump(get_user_by( 'login', $user_name ));
    var_dump(get_user_by( 'email', $user_email));

 // Registration logic
 if(get_user_by( 'login', $user_name ) === false && 
    get_user_by( 'email', $user_email) === false) { 
        //register the user
 }

The problem is that, if I press register button (send request to the server with all user data) two times and second time is before I get the response from the server, get_user_by('login', ..) and get_user_by('email, ..') are false and then I have two registered users with the same email.

What can be the reason ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.