Amir Habibi (@amirhabibi)

Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • In reply to: Accents in username

    meitershaker: ;-) be patient!!

    In reply to: Accents in username

    meitershaker : are you talking about the 1.0 alpha ?

    In reply to: Accents in username

    Thanks for your replies. After reading / testing your links, I found a quick working fix. Here’s the plugin code :

    <?php
    /*
    Plugin Name: UTF-8 usernames
    Plugin URI:
    Description: This plugin enable utf-8 characters in usernames. Mbstring must be enabled in the php.ini.
    Author: Amir Habibi
    Author URI: http://www.residence-mixte.com/
    Version: 0.1
    */

    function sanitize_user_mbstring( $raw_username, $username, $strict = false ) {
    $raw_username = $username;
    $username = strip_tags($username);
    // Kill octets
    $username = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $username);
    $username = preg_replace('/&.+?;/', '', $username); // Kill entities

    // Usage of 'mb_ereg_replace' instead of 'preg_replace' to preserve accents.
    if ( $strict )
    $username = mb_ereg_replace('|[^a-z0-9 _.-@]|i', '', $username);

    return apply_filters('sanitize_user_mbstring', $username, $raw_username, $strict);

    }

    add_action('sanitize_user', 'sanitize_user_mbstring', 0, 3);
    ?>

    To work, you must have mstring enabled in your php.ini.

    Hope this will help !

    chrishajer : our board is in french

    Hi sambauers,

    Is there a specific file to change or i have to get the hole commit ?

    For info, the bug is visible in this forum !

Viewing 5 replies - 1 through 5 (of 5 total)