• Resolved baddon250

    (@baddon250)


    I have my registration form with the validate username field set, and I just had a user register with a space in their username, that should not be allowed because it’s breaking all my scripts. The username was something like “John Doe”.

Viewing 2 replies - 1 through 2 (of 2 total)
  • @baddon250

    You can try this code snippet which will remove all spaces in the username.

    add_filter ( 'sanitize_user', 'my_um_remove_user_spaces', 10, 3);
    
    function my_um_remove_user_spaces( $username, $raw_username, $strict = false ) {
    
        return str_replace( ' ', '', $username );
    }

    Install the code snippet in your active theme’s functions.php file
    or use the “Code Snippets” plugin.

    https://www.ads-software.com/plugins/code-snippets/

    Plugin Support andrewshu

    (@andrewshu)

    Hi @baddon250

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread if any other questions come up and we’d be happy to help. ??

    Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with the Registration Form’ is closed to new replies.