Skip to:
Content

Ticket #452: usernames_i18n_fix.php

File usernames_i18n_fix.php, 1.3 KB (added by Sewar, 7 years ago)

Important plugin for non-English forums

Line 
1<?php
2/*
3Plugin Name: Usernames I18N Fix
4Plugin URI: http://sewar.wordpress.com/bbpress/plugins/usernames_i18n_fix/
5Description: Allow users to use I18N non-English  names.
6Author: Sewar
7Author URI: http://sewar.wordpress.com
8Version: 1.0
9*/
10
11/*
12    Usernames I18N Fix, bbPress plugin allows users to use I18N non-English names.
13    Copyright (C) 2006  Sewar
14
15    This program is free software; you can redistribute it and/or modify
16    it under the terms of the GNU General Public License as published by
17    the Free Software Foundation; version 2 of the License.
18
19    This program is distributed in the hope that it will be useful,
20    but WITHOUT ANY WARRANTY; without even the implied warranty of
21    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22    GNU General Public License for more details.
23
24    You should have received a copy of the GNU General Public License
25    along with this program; if not, write to the Free Software
26    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27*/
28
29function user_sanitize_i18n_fix($text, $raw, $strict){
30        $new_text = $raw;
31
32        if ( $strict )
33                $new_text = preg_replace('|-+|', '-', $new_text);
34
35        return $new_text;
36}
37
38add_filter('user_sanitize', 'user_sanitize_i18n_fix', 10, 3);
39
40?>