• Resolved topquark

    (@topquark)


    How do I configure or what file can I edit to allow backslashes in usersnames. I’m setting a weblog that requires usernames of the form ‘Domain\Userid’. I have the latest WordPress running but when I try to create a new account of the form ‘Domain\Username’, I get Invalid username error message.

    Any help or pointers is appreciated. Thanks.

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

    (@topquark)

    I fixed the problem by updating the regular expression in the sanitize_user function in wp-includes/functions-formatting.php to allow backslashes.

    Updated
    $username = preg_replace('|[^a-z0-9 _.\-@]|i', '', $username);

    To
    $username = preg_replace('|[^a-z0-9 _.\-@\\\\]|i', '', $username);

    For those not wanting to modify the WordPress code, I found a similar need wrapped as a WordPress plugin, namely wp-allowdashes. This provided me with a template to create wp-allowbackslashes which can be accessed from here

Viewing 1 replies (of 1 total)
  • The topic ‘Allowing backslashes in usernames’ is closed to new replies.