Support » Plugin: Nextend Social Login and Register » Problem with Cyrillic letters in username

  • Resolved pchela

    (@pchela)


    Hi!
    Thanks for your plugins, it`s the best now!

    But I have a problem with Cyrillic letters in username. Earlier I was assisted by the plugin WordPress Special Characters in Usernames, but now it doesn’t work either.

    How can I fix it? Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Nextendweb

    (@nextendweb)

    Hi @pchela,
    this popped up few days ago in this topic: https://wordpress.org/support/topic/suggestion-for-improving-the-plugin/

    Am I right that you want to allow cyrillic characters in usernames?

    I used the following code to allow cyrillic characters:

    function acu_sanitize_user($username, $raw_username, $strict) {
        $username = wp_strip_all_tags( $raw_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 and Cyrillic characters for max portability.
        if ( $strict )
            $username = preg_replace( '|[^a-zа-яа-я0-9 _.\-@]|iu', '', $username );
    
        $username = trim( $username );
        // Consolidate contiguous whitespace
        $username = preg_replace( '|\s+|', ' ', $username );
        return $username;
    }
    add_filter('sanitize_user', 'acu_sanitize_user', 10, 3);

    Does it work as expected?

    Thread Starter pchela

    (@pchela)

    @nextendweb thank’s, it’s work. Fine!

    Plugin Author Nextendweb

    (@nextendweb)

    Great, I’m happy that I could help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Problem with Cyrillic letters in username’ is closed to new replies.