Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there,

    Thanks for writing in,

    We just rechecked the code snippet after reading this ticket and we found that the code works as intended. Please check the screenshot in the link below for reference.
    https://prnt.sc/_h5aXDCE8yYl
    Would you please try clearing the site’s cache after adding the code?
    It does have an issue with the auto-login though. I have forwarded this information to our developers. They will look into this.

    Regards!

    Hi there,

    Please use the following code.

    add_filter( 'user_registration_before_insert_user', 'ur_insert_username', 10, 3 );
    function ur_insert_username( $user_data, $valid_form_data, $form_id ) {
        $user_data['user_login'] = $valid_form_data['user_email']->value;
        return $user_data;
    }
    
    add_filter( 'user_registration_before_register_user_filter', 'ur_set_email_as_username', 10, 2 );
    function ur_set_email_as_username( $valid_form_data, $form_id ) {
        $valid_form_data['user_login'] = $valid_form_data['user_email'];
        return $valid_form_data;
    }

    Regards!

    Hi there,

    Since we haven’t heard from you in a while, I’m going to go ahead and conclude this thread for now. However, if you have any further questions or if there’s anything else we can assist you with, please feel free to continue the conversation.

    Regards!

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

The topic ‘Username as Email Code Snippet Not Working’ is closed to new replies.