• I have searched these forums and found the code in the file where the characters not allowed in usernames seems to be stored. As i really could use allowing hyphens and underscores in the usernames of my community, and as the topics i found don’t explain HOW to modify this code, i’d really appreciate some help with this!

    From wp-includes/formatting.php row 778:

    // Kill octets
    $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
    $username = preg_replace( '/&.+?;/', '', $username ); // Kill entities

    So does anyone understand that code and how to modify it to allow hyphens and underscores? I don’t even understand whether this code allows or disallows.

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

    (@hysteriux)

    This is a bit odd: in the formatting.php document in the wp-includes folder it states the following:

    “Sanitize username stripping out unsafe characters.
    Removes tags, octets, entities, and if strict is enabled, will only keep alphanumeric, _, space, ., -, @.”

    However, even while setting “function sanitize_user” to strict, it still says “Only small letters and numbers allowed” when registering a new username. WordPress doesn’t even listen to it’s own code or what? Is this a bug?

    WP 3.3.1

Viewing 1 replies (of 1 total)
  • The topic ‘How to customize the username sanitation?’ is closed to new replies.