(07-03-2010 07:44 PM)ZiNgA BuRgA Wrote: [ -> ]- checks username in AJAX registration
- added setting under User Registration and Profile Options, where you can enter in additional characters you want to allow
With this setting, this plugin is really useful and give us more flexibility. Thank you very much, Yumi.
Sure! it is a useful Plugin
However, I wonder if it is possible to disallow some characters using regex!!
I would like to disallow all latin charaters [a-z] [A-Z] so only arabic characters are allowed
Back in the time when I was using phpbb3, this was acheived by :
Code:
$regex = '[\p{Arabic}0-9-[\]_+ ]*\p{Arabic}+[\p{Arabic}0-9-[\]_+ ]*';
|
This also ensures that choosen username contains at least on alphabet, and not only numerics
Do a search for preg_match and edit it with whatever regex you want.
Thanks for prompt reply
I found:
Code:
return !preg_match('#[^0-9a-zA-Z'.strtr($mybb->settings['stduname_allowedchars'], array('\\' => '\\\\', '[' => '\\[', ']' => '\\]', '-' => '\\-')).']#', $name);
|
So is it simply a matter of replacing 0-9a-zA-Z by p{Arabic}0-9
?
No, you need to replace [^0-9a-zA-Z'.strtr($mybb->settings['stduname_allowedchars'], array('\\' => '\\\\', '[' => '\\[', ']' => '\\]', '-' => '\\-')).'] with whatever you wish
Unfortunately, it didnot work
Basically, I need to ensure two things:
1- That username contains arabic characters only: p{Arabic}
I mean I want to disallow all latin characters: a-zA-Z
2- That username contains AT LEAST one alphabet, so username with numerics only like 555586 are disallowed
That's interesting - I wonder why I couldn't find that in the official docs. (I blame the documentation >_>)
Take a look at the regex used inside preg_match. The page you linked seems to suggest that the "u" modifier is required. I'm using "#" as a delimiter instead of "/", so you need to stick the "u" after the second "#". See if that helps.
Hi! I found a bug in this plugin.
If I don´t allow spaces in usernames, but a user register with spaces in the end of username, the plugin allow the use of that username.
Example: Disallow spaces in usernames. Then, register for example with this username u1 and put 1 or more spaces at the end of the username. Bingo! It´s allowed.