[buddypress-trac] [BuddyPress Trac] #6389: buddypress doesn’t support chinese login name

buddypress-trac noreply at wordpress.org
Wed Apr 22 13:22:46 UTC 2015


#6389: buddypress doesn’t support chinese login name
-------------------------------------------------+-------------------------
 Reporter:  wenlujon                             |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Under
Component:  API - Rewrite Rules                  |  Consideration
 Severity:  major                                |     Version:  2.2.1
 Keywords:  chinese login name reporter-         |  Resolution:
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by wenlujon):

 I added the following code for supporting Chinese name register, in ms-
 functions.php:
 --- wp-includes/ms-functions.php.orig   2015-04-21 13:32:39.181687801
 +0000
 +++ wp-includes/ms-functions.php        2015-04-21 14:21:02.772291702
 +0000
 @@ -462,7 +462,7 @@
         $orig_username = $user_name;
         $user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name,
 true ) );

 -       if ( $user_name != $orig_username || preg_match( '/[^a-z0-9]/',
 $user_name ) ) {
 +       if ( $user_name != $orig_username || (preg_match(
 '/[^a-zA-Z0-9]/', $user_name ) && preg_match( '/[^\u4e00-\u9fa5]/',
 $user_name ) )) {
                 $errors->add( 'user_name', __( 'Only lowercase letters
 (a-z) and numbers are allowed.' ) );
                 $user_name = $orig_username;
         }

 and add the filter in my theme functions.php:
 function ludou_non_strict_login( $username, $raw_username, $strict ) {
     if( !$strict )
         return $username;

     return sanitize_user(stripslashes($raw_username), false);
 }
 add_filter('sanitize_user', 'ludou_non_strict_login', 10, 3);

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6389#comment:4>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list