Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How to limit usernames to just letters, numbers & underscores? (like Twitter)
byakko
New
Is there a way to set the username restrictions like Twitter's during registration?
I did some digging and I'm not sure how to edit this particular code so it's A-Z, a-z, 0-9, and _
$Configuration['Garden']['User']['ValidationRegex'] = '[a-z]';
And can I get feedback on these?
$Definition['UsernameError'] = "Username can only contain letters, numbers, and underscores, and must be between 3 and 15 characters long.";
(display rules)
$Configuration['Garden']['User']['ValidationLength'] = array(3,15)
(max username chararacters on twitter is 15)
Thanks!
0
Comments
The regex you are looking for is:
The length restriction is:
So you put in your
/conf/config.php
file:I validated these options via http://www.phpliveregex.com/
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
I just realized I left out numbers in the regex.
[A-z0-9_]
will allow names to have numbers in them.Sorry about that.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.