limited characters for user name*
how to set limited characters for username ,
so guest cant select a username which is too long or too short.
also how to stop username include _ or . or - ?
vanilla 2.1b2
Best Answers
-
peregrine MVP
you can change the validation:
e.g. would only allow lower-case letters in name.
$Configuration['Garden']['User']['ValidationRegex'] = '[a-z]';
only allow what you want in your regular expression.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
6 -
peregrine MVP
you could also override function by creating your own ValidateUsername...
if (!function_exists('ValidateUsername')) { function ValidateUsername($Value, $Field = '') { $ValidateUsernameRegex = ValidateUsernameRegex(); return ValidateRegex( $Value, "/^({$ValidateUsernameRegex})?$/siu" ); } } you can also change the min and max length by minimum 5 and max 10 $Configuration['Garden']['User']['ValidationLength'] = array(5,10)
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
2 -
peregrine MVP
and the requisite change to your definition of the message generated by validation error.
e.g.
$Definition['UsernameError'] = "only lowercase letters allowed";
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
2
Answers
from a UI perspective you need to add a validation expression to the username field of the account creation form.
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
@jeongwee
from a coding perspective, if you post questions without expressing your vanilla version, you will not only continue to give a bad example for future people who can't read the message at the top of the forum , but it will prevent people from trying to help you with the exact version you are using.
Granted, there are some people who insist the discussion question MAY not or DOES not require your vanilla version, BUT it certainly can't hurt, and it can only help. It may be the same answer no matter what version of vanilla you are using, but it will rule out the possibility of multiple answers or the wrong answer based on assumption of vanilla version which may be incorrect.
Sometimes consistency in ALWAYS providing vanilla version with question, can be an advantage.
**Message at top:
" When posting a question on the forum, please include the version number of Vanilla you are using."**
k, k no apology necessary. proof will be when you post your future questions.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
= = sry man...im dumb always forgot to tell version :O
i wrote it into my name title ,so even if i still forgot it next time, ppl will see my version
also if you can take a look at this http://vanillaforums.org/discussion/24707/symbloeditor-feedback#latest
the reason i don wanna let username inlucde like "_" becoz it wont work with symboleditor, user have to change the link manually.
thx,may i know the steps, i donno how to do it.
i wanna made it highest allowed 16Byte ,nolimited for lowest.
and dont allowed include "_" and "." and "-" .
sorry, only advice is free. there are lots of examples of form validation in existing plugins. otherwise see "Custom Plugin Development" in my signature.
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
you can change the validation:
e.g. would only allow lower-case letters in name.
$Configuration['Garden']['User']['ValidationRegex'] = '[a-z]';
only allow what you want in your regular expression.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
you could also override function by creating your own ValidateUsername...
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@peregrine thank you so much !
and the requisite change to your definition of the message generated by validation error.
e.g.
$Definition['UsernameError'] = "only lowercase letters allowed";
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.