Hi! When you try to register a name containing accents, the accents are stripped.
Any solution ?
(0.9.0.2 & the bug is visible on this forum)
bbPress support forums » Troubleshooting
Accents in username
(18 posts)-
Posted 2 months ago #
-
This is the latest discussion I heard about the issue:
http://bbpress.org/forums/topic/diacritic-letters-i-username-like-goranWhat is the primary language of your forum?
Posted 2 months ago # -
There's also plugins like this which can easily be modified:
http://bbpress.ru/files/plugins/CyrNickname.zip
http://trac.bbpress.org/attachment/ticket/452/usernames_i18n_fix.php
Posted 2 months ago # -
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
Posted 2 months ago # -
great it works! but for choose a name to display on public (option in profil), a name with accents doesn't work ...
Posted 2 months ago # -
meitershaker : are you talking about the 1.0 alpha ?
Posted 2 months ago # -
amir: yes :p
ps: et plus précisément de la 1.0 trunk :p
Posted 2 months ago # -
meitershaker: ;-) be patient!!
Posted 2 months ago # -
my problem is already here :( little help please :p
Posted 2 months ago # -
It should be noted that using non ascii characters in bbPress is not supported and you could open yourself to a whole range of potential SQL injection threats by doing so.
WordPress has never supported non-ascii characters in usernames and has compensated by allowing display names, bbPress 1.0 now allows display names as well for the same reason.
Posted 1 month ago # -
sambauers,
may I ask why non-ascii chars for user name can make the threats of SQL injection etc greater?Posted 1 month ago # -
@myu
It has to do with people using different character encoding for their database tables other than UTF-8. I'm probably overstating the threat as the same problem exists on all data input and we filter it out the problem there. I was also just reviewing WordPress injection attacks of days gone by, so it was on my mind.
In any case, the solution in the future is to change your display name after registration. Display names are UTF-8 friendly.
Posted 1 month ago # -
Thanks for reply.
Me, I personally don't mind using alphabet for username, but have to think of target audience. Got me worried a bit. :)I hope in the future version there's some sort of conversion mechanism for people that's already registered using utf-8 encoded username. (pretty please..)
Posted 1 month ago # -
@ sam
"In any case, the solution in the future is to change your display name after registration. Display names are UTF-8 friendly. "doesn't work!!
me, 2 weeks ago:
"but for choose a name to display on public (option in profil), a name with accents doesn't work ... "Posted 1 month ago # -
@ meitershaker
There was a bug in the display name implementation. First, update to the very latest trunk. There is a chance that you might have a user meta item for some users called 'display_name'. This will be stomping on the real setting in the user table. Use this SQL query to clear out the bad data.
DELETE FROM bb_usermeta WHERE meta_key = 'display_name';Once you've updated to the latest trunk and done that, you should be able to use any UTF-8 character in display names.
Posted 1 month ago # -
it works! =p thanks ;)
Posted 1 month ago # -
Great!
Posted 1 month ago # -
Will it be possible to upgrade to 1.0 when there're people registering with utf8 usernames?
(I'm still testing and editing with 0.9, and will need utf8 names)
Or will it be better to use 1.0 alpha?Posted 1 month ago #
Reply
You must log in to post.