Announcement

Collapse
No announcement yet.

User Profile Fields

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Steve Machol
    replied
    Originally posted by exegete View Post
    With respect, I am not certain that this is correct.
    I believe you are right. Not sure what I was thinking.

    Leave a comment:


  • exegete
    replied
    Originally posted by Steve Machol View Post
    Sorry, there is no function to do this. This requires modifying the code. We cannot officially support code modifications or forums running modified code, however you can try searching or asking for help with this over at www.vbulletin.org.
    With respect, I am not certain that this is correct.

    If you require the user field to match the regular expression "^.+$" (without quotes), the user must enter at least one character in the field and cannot leave the field blank.

    I discovered this inadvertently when upgrading from 3.5 to 3.8.

    We had a user field for mobile phone numbers with the regular expression "^[\d\s-]+$" (without quotes) - the effect was that, if the user entered anything in this field, it was required to be a series of numbers, spaces and/or hyphens. If nothing was entered in the field, no attempt was made to match the pattern.

    Upon upgrading to 3.8 we discovered that users who edited their profiles were being required to enter a value for this field, whereas previously they were permitted to leave the field blank.

    I resolved this by changing the "+" in the regular expression to a "*" so as to allow for empty strings, but it does appear to indicate that users can be forced to enter a minimum number of characters in user fields.

    Garamond, as a quick reference guide, try one of these expressions:

    .+ means one or more characters (or at least one character)
    .{3} means exactly three characters
    .{3,10} means between three and ten characters inclusive
    .{3,} means at least three characters

    I should note that if you were only interested in default user fields (such as email) rather than custom added user fields, this probably doesn't apply.

    Leave a comment:


  • feldon23
    replied
    Garamond,

    Actually, this can be done with a fairly simple template modification. Last time I checked, nobody gets banned (or loses tech support) for using template mods, so...


    In the register template, the form verifies that A) both password fields have been filled out, B) both password fields match, and C) COPPA is not being bypassed. If any of these conditions are false, then it throws up a javascript error. It would be trivially easy to add other verifications and I wish this was a feature of vBulletin.

    For example if I wanted to make sure that the e-mail address is at least 5 characters long, I could:

    Change:
    Code:
    <form action="register.php?do=addmember" name="register" method="post" onsubmit="return verify_passwords(password, passwordconfirm);">
    To:
    Code:
    <form action="register.php?do=addmember" name="register" method="post" onsubmit="return verify_passwords(password, passwordconfirm, email);">
    Change:
    Code:
    function verify_passwords(password1, password2)
    To:
    Code:
    function verify_passwords(password1, password2, email)
    and Under:
    Code:
        else if (password1.value != password2.value)
        {
            alert('$vbphrase[entered_passwords_do_not_match]');
            return false;
        }
    Add:
    Code:
        else if (email.length <= 5)
        {
            alert('You must enter a valid e-mail address.');
            return false;
        }
    I just tested it and it works great on my forum.

    Leave a comment:


  • fufu
    replied
    Originally posted by Steve Machol View Post
    Sorry, there is no function to do this. This requires modifying the code. We cannot officially support code modifications or forums running modified code, however you can try searching or asking for help with this over at www.vbulletin.org.
    Originally posted by Garamond View Post
    Can I define a minimum amount of characters that users must write in their User Profile Fields, that is more than 1?
    I have had SPAM BOTS that fill in the number "1" as a value all the way down the registration requirements. I do see this as a much needed feature.

    Leave a comment:


  • Steve Machol
    replied
    Sorry, there is no function to do this. This requires modifying the code. We cannot officially support code modifications or forums running modified code, however you can try searching or asking for help with this over at www.vbulletin.org.

    Leave a comment:


  • Garamond
    started a topic User Profile Fields

    User Profile Fields

    Can I define a minimum amount of characters that users must write in their User Profile Fields, that is more than 1?
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X