Username with quote can't login
-
Hi ?? Could I ask you an advice please?
I need to permit users to login with their stardard username, but that it could include a single quote. Currently I’ve added a custom filter that permits them to register with this special character in the username, but currently they aren’t able to login with their username if it includes a single quote..
function custom_sanitize_user( $username, $strict = false ) { $username = wp_strip_all_tags( $username ); //$username = remove_accents( $username ); // Kill octets $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username ); $username = preg_replace( '/&.+?;/', '', $username ); // Kill entities // If strict, reduce to ASCII for max portability. //if ( $strict ) // $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username ); $username = trim( $username ); // Consolidate contiguous whitespace $username = preg_replace( '|\s+|', ' ', $username ); return $username; } add_filter('sanitize_user', 'custom_sanitize_user', 999, 2);
Do you have any idea how can I do it please?
Best regards
– Chris
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Username with quote can't login’ is closed to new replies.