Skip to:

Re: underscore stripped from username?

At the end of the plugin you can see:

add_filter('user_sanitize', 'user_sanitize_i18n_fix', 10, 3);

That adds the function defined in the plugin to the user_sanitize hook. Grepping the core files for user_sanitize, you find return apply_filters( 'user_sanitize'[…] in bb-includes/formatting-functions.php, in the function user_sanitize. When that function is called with strict = true, it removes what it considers not to be a letter, a number or a ‘-‘ from the first parameter (the provided username), and replaces repetitions of ‘-‘ with just one. So the underscore is removed. When strict is false, underscores are kept. Another effect is that accented characters and other such niceties of international scripts are also invalidated.

After doing that, it runs the filters, telling them its result, the original value and the value of strict. If installed, usernames-i18n-fix will be one of those filters. It returns the original username value (that is, with whatever characters were there from the beginning) if not in strict mode. If strict is true, it just replaces repetitions of ‘-‘ with only one ‘-‘.

So that’s how I read it. But I don’t know if the names really need the sanitazion.

Skip to toolbar