MyBB Community Forums

Full Version: Minimum Characters in Custom Profile
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Can I set a minimum amount of characters in a Custom Profile field, I cannot seem to find a minimum, there is a maximum, but no minimum
Go to ACP>>Templates & Styles>>Templates>>Your Template>>User Control Panel Templates>>usercp_profile_customtitle

Find:
<td><input type="text" class="textbox" name="usertitle" size="25" maxlength="{$mybb->settings['customtitlemaxlength']}" value="{$newtitle}" /></td>

and replace with:
<td><input type="text" class="textbox" name="usertitle" size="25" minlength="5" maxlength="{$mybb->settings['customtitlemaxlength']}" value="{$newtitle}" /></td>

Modify this according to your needs: minlength="5"
Thanks for your reply, but wont that set a minimum for them all?? I only want a minimum for 1 of the 3 that I have just created
Anyone else?
No it will only set the minimum value to that particular line which is customtitle
Ok im slightly confused now.

I have created 2 new fields for my registration, (Im guessing you call these custom profile fields?)

I want a minimum on both of them, but a different minimum amount. here is the code as per FireBug

<input id="fid1" type="text" class="textbox" name="profile_fields[fid1] size="0" maxlength="8" value=""">

<input id="fid4" type="text" class="textbox" name="profile_fields[fid4] size="0" maxlength="30" value=""">

Now if I change the
ACP>>Templates & Styles>>Templates>>Your Template>>User Control Panel Templates>>usercp_profile_customtitle

From:
<td><input type="text" class="textbox" name="usertitle" size="25" maxlength="{$mybb->settings['customtitlemaxlength']}" value="{$newtitle}" /></td>

to:
<td><input type="text" class="textbox" name="usertitle" size="25" minlength="5" maxlength="{$mybb->settings['customtitlemaxlength']}" value="{$newtitle}" /></td>

then surely it will add a minimum length, with that minimum length being the same on both?
Just add minlength="your minimum value"
(2013-09-19, 12:06 PM)marcus123 Wrote: [ -> ]Just add minlength="your minimum value"

how does that work when mybb loops through the custom user fields array ? the OP needs different minimum length value for each field not just a fixed minimum length ... the answer is perhaps a small plugin to add the value when mybb loops
Yea I did try marcus but it didnt work, I put min lengh as 10 and it still allowed me to register with 3 characters.