Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: BP-FBConnect – usernames with foreign characters


levin
Participant

@levinng

make a plugin as below to allow non-ansi character account name

<?php

add_filter( 'sanitize_user', 'my_sanitize_user',3,3);

function my_sanitize_user($username, $raw_username, $strict){

$username = $raw_username;

$username = strip_tags($username);

$username = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $username);

$username = preg_replace('/&.+?;/', '', $username); // Kill entities

if ( $strict )

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

$username = preg_replace('|\s+|', ' ', $username);

return $username;

}

?>

Skip to toolbar