Options

Signup Validation Settings Not Working

Hi, I'm trying to limit the character usernames signup on my forum, but when I set it using one of the tutorials found here, it still does not apply and says 3-20. I set it below 10. I tried both the array(3,10) and {3,10} method but no luck.

Please help.

Tagged:

Comments

  • xifekobo said: but when I set it using one of the tutorials found here,

    should we guess which ones you looked at and "didn't work" , or do you want to provide links. than you can be advised.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • RiverRiver MVP
    edited September 2016

    @xifekobo said:
    Hi, I'm trying to limit the character usernames signup on my forum, but when I set it using one of the tutorials found here, it still does not apply and says 3-20. I set it below 10. I tried both the array(3,10) and {3,10} method but no luck.

    Please help.

    for the english language this is one way.

    Changes message that appears

    in conf/locale.php add this.

    $Definition['UsernameError'] = 'Username can only contain letters, numbers, underscores, and must be between 5 and 10 characters long.';

    https://vanillaforums.org/discussion/comment/207043#Comment_207043

    https://vanillaforums.org/discussion/26597/tutorial-how-to-change-wording-how-to-change-text-how-to-change-language-how-to-change-locale/p1

    Validates between 5 and 10

    in conf/config.php
    $Configuration['Garden']['User']['ValidationLength'] = "{5,10}";

    https://vanillaforums.org/discussion/comment/218973/#Comment_218973

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • thanks I think all tutorials have the same solution as it is one key like that but with different combinations that I mentioned above.

    $Configuration['Garden']['User']['ValidationLength']

    I tried the bracket and array type. Though I did not put the UserNameError message, is that required? afaik know that is only for displaying.

  • @xifekobo said:
    thanks I think all tutorials have the same solution as it is one key like that but with different combinations that I mentioned above.

    $Configuration['Garden']['User']['ValidationLength']

    I tried the bracket and array type. Though I did not put the UserNameError message, is that required? afaik know that is only for displaying.

    well the translation is for displaying, that is what I tried to say. translation displays. config statement validates.

    you could make this easier!
    -what language are you using? english? what user name did you try! please provide a specific example.

    • what about utf-8 and pcre.
    • did you modify or make a config statement with $Configuration['Garden']['User']['ValidationRegex'] ? if so, what?

    you could temporarily debug here

    https://github.com/vanilla/vanilla/blob/Vanilla_2.2.1/library/core/functions.validation.php#L254

    by inserting

    var_dump($ValidateUsernameRegex);
    die();

    then printing your result and then removing the two lines.

    non -intrusive test

    alternatively you could create a regextext.php file and run it from your web browser.

    <?php 
    $value = "bad";
    $regex1 = "[\w]{4,10}";
    $regex2 = "[\pN\pL\pM\pPc]{4,10}" ;
    $regex1 = "/^({$regex1})?$/siu";
    $regex2 = "/^({$regex2})?$/siu";
    echo "$regex1 $value is " ;
    var_dump(filter_var($value, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $regex1))));
    echo "<br>";
    echo  "$regex2 $value is ";
    var_dump(filter_var($value, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $regex2))));
    echo "<br>";
    $value = "good";
    echo "$regex1 $value is ";
    var_dump(filter_var($value, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $regex1))));
    echo "<br>";
    echo  "$regex2 $value is ";
    var_dump(filter_var($value, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $regex2))));
    

    then post the results.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • xifekoboxifekobo New
    edited September 2016

    Thanks. Of course English and I already changed it, here's my settings on that part:

    For now I only would like to set a preferred username limit like this:

    $Configuration['Garden']['User']['ValidationLength'] = array(4,15);
    

    my sample is just entering 2 chacters username, when I entered a valid email correctly, the 2 char username also validates. This is becoming a bit of a problem now for me :/

    Ok I will try the debugging there.

  • Are there any plugins that can do this for a forum? like min-max characters. tickers for uppercase, lowercase then numbers.. etc.

    too complicated for a normal owner and I should point out again that the default messages says 3 char minimum whereas I already tested it validates for 2 only. That's a bug right there unless you have typo on the message.

Sign In or Register to comment.