WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#18666 closed defect (bug) (duplicate)

Can't register with Arabic usernames

Reported by: walid3 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2.1
Component: General Keywords:
Focuses: Cc:

Description

I don't know why but every time I try to register new Arabic username in my blog it gives error, although I set "ar" in wp-config and Arabic language is working well all over the blog, but can't create username in Arabic at all, I have my admin name in English but want to allow users t have Arabic names, I don't know if it's bug in my side or it's the way it is? and is there any fix for that I can manually do?, as I can't have Arabic website which can't have Arabic usernames :)
Thanks for your time.

Attachments (1)

allow-arabic-usernames.php (982 bytes) - added by SergeyBiryukov 3 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 dd323 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

comment:2 walid33 years ago

"Opened 4 years ago" ? so if I understand it right..this problem have been there for 4 years..glad to not be the first! can I ask for any way to allow using Arabic usernames disregarding the security matter? :)

Last edited 3 years ago by walid3 (previous) (diff)

comment:3 SergeyBiryukov3 years ago

As a workaround, you could probably hook to sanitize_user filter and create a function to sanitize usernames in your own way.

See Allow Cyrillic Usernames plugin for reference. It basically duplicates sanitize_user() function, adding Cyrillic characters to the regular expression.

comment:4 walid33 years ago

Thanks so much for you comment Sergey, I downloaded your plugin trying to figure out what to change to get Arabic to work, but with no knowledge in php I couldn't figure that out. can you guide me how to change it to suite Arabic and then after I test it in my website you publish it as a plugin? I have seen many users asking for Arabic usernames, so it will help a lot.

comment:5 SergeyBiryukov3 years ago

Please check if the attached plugin works for you.
The difference is in the regular expression:

$username = preg_replace( '|[^a-z\p{Arabic}0-9 _.\-@]|iu', '', $username );

It uses \p{Arabic} Unicode script.

comment:6 walid33 years ago

Thanks again Sergey, it seems it's harder for Arabic than Russian, it let the user sign up for username in Arabic successfully, but when you try to visit member page (buddypress) it say:

We're sorry, but we can't find the page that you're looking for. Perhaps searching will help.

Perhaps it doesn't recognize Arabic username in URL for some reason, and when I login by the user it show the name in strange letters and symbols:

http://imageshack.us/photo/my-images/197/arabicusername.jpg/

so the plugin did the job well, but it's wordpress that is not used to have Arabic usernames, so problems appear, have you met with such problems in Russian plugin?

comment:7 SergeyBiryukov3 years ago

I've tested the plugin on a clean WordPress installation, and author pages seem to work fine with Arabic and Cyrillic usernames.

Perhaps BuddyPress has more limitations on username. I've tried to create a user with Cyrillic username in BuddyPress 1.5-rc-1, and I got 400 Bad Request on the member page.

At this point, it's a BuddyPress issue, which should be reported on http://buddypress.trac.wordpress.org/.

Note: See TracTickets for help on using tickets.