Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am from Turkey and we have "şŞçÇğĞüÜöÖıİ" characters in our alphabet.

I want to use those characters in permalinks/slugs/usernames. I found temporary solution for permalinks/slugs with core-hacking. There is no other option for it except core-hacking seems. You can find solution here:

http://core.trac.wordpress.org/ticket/15248

My problem is, user registration need a little fix after this one too. Fortunately there is filter i can use but couldnt handle it:

in wordpress includes/formatting.php :

function sanitize_user( $username, $strict = false ) {
 $raw_username = $username;
 $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 apply_filters( 'sanitize_user', $username, $raw_username, $strict );
}

This section of code is producing error:

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

Somehow i need to disable this section. But i am not sure how to do it.

share|improve this question
    
Mighty good question, This problem is not only in Turkey. It is basically in every European language which is not English. Come to think about it - the problem exists for every language in the world that is not English ! ( Chinese, Japanese, Korean, Arab, Hebrew , Hindu ... basically 2/4 of the world population ... ) –  krembo99 Dec 31 '13 at 14:47
    
@krembo99 I created plugin for this purpose: wordpress.org/plugins/wordpress-turkce You can inspect and modify it for your language too –  Ünsal Korkmaz Dec 31 '13 at 15:49

1 Answer 1

up vote 1 down vote accepted

Try this (not tested, I hope I am not short circuiting it into endless loop):

add_filter('sanitize_user', 'non_strict_login', 10, 3);

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

    if( !$strict )
        return $username;

    return sanitize_user(stripslashes($raw_username), false);
}
share|improve this answer
    
after long long searches, seems its not something supported in php community yet.. unicode permalinks basically what i want seems.. I have an ideas page about it: wordpress.org/extend/ideas/topic/non-latin-characters-need-love –  Ünsal Korkmaz May 14 '11 at 13:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.