View Full Version : How to...
Smoothie
03-10-2003, 07:23 AM
1. Add a minumum character input that a user has to add when filling in the profile field: Location?
2. Update all users profile field: Location-> to blank, no info?
3. Make the profile field: Location, only show in the postbit if info was entered. If nothing is entered, it won't display.
Thanks in advance!
squawell
03-10-2003, 08:36 AM
3.try this one
open functions.php find:
if ($post[aim]!="") {
eval("\$post[aimicon] = \"".gettemplate("aim")."\";");
} else {
$post[aim]="";
below it add:
if ($post[field2]) {
$location="Location: $post[field2]<br>";
} else {
$location="";
}
and put $location in postbit whatever u want...
Smoothie
03-10-2003, 08:43 AM
Thanks! Will give it a try. I really need number 1. :)
Xenon
03-10-2003, 11:42 AM
for 1:
in register.php it will work somehow similar, but i'll show you how to do in member.php :)
find that:
$varname="field$profilefield[profilefieldid]";
if ($profilefield[required] and $$varname=="")
{
eval("standarderror(\"".gettemplate("error_requiredfieldmissing")."\");");
exit;
}
and change to:
$varname="field$profilefield[profilefieldid]";
if (($profilefield[required] and $$varname=="") or ($profilefieldid == 2 and $$varname != "" and strlen($$varname)<5))
{
eval("standarderror(\"".gettemplate("error_requiredfieldmissing")."\");");
exit;
}
that will disallow all inputs smaller than lenght of 5 except no input :)
Smoothie
03-10-2003, 04:42 PM
that will disallow all inputs smaller than lenght of 5 except no inputUnless its a required field, no?
Xenon
03-10-2003, 04:50 PM
it has nothing to do with the required state :)
it's jsut for field id2 :)
Smoothie
03-10-2003, 04:52 PM
Originally posted by Xenon
for 1:
in register.php it will work somehow similar, but i'll show you how to do in member.php :)
find that:
$varname="field$profilefield[profilefieldid]";
if ($profilefield[required] and $$varname=="")
{
eval("standarderror(\"".gettemplate("error_requiredfieldmissing")."\");");
exit;
}
and change to:
$varname="field$profilefield[profilefieldid]";
if (($profilefield[required] and $$varname=="") or ($profilefieldid == 2 and $$varname != "" and strlen($$varname)<5))
{
eval("standarderror(\"".gettemplate("error_requiredfieldmissing")."\");");
exit;
}
that will disallow all inputs smaller than lenght of 5 except no input :) Wouldn't this just give them the required field message missing jargon if they inputed less than 5 characters? How would they know it was because they entered less characters than required?
Xenon
03-10-2003, 04:54 PM
it was jsut the fast way ;)
you can of course create a new errortemplate and change the one if clause into too if needed :)
Smoothie
03-10-2003, 04:55 PM
Originally posted by Xenon
it has nothing to do with the required state :)
it's jsut for field id2 :) But if it were a required field to fill in, they wouldn't be able to leave it blank. that will disallow all inputs smaller than lenght of 5 except no inputI'm assuming you mean by no input leaving the filed empty?
Xenon
03-10-2003, 05:38 PM
if it's a required field, it shouldn't be able to left blank right?
filburt1
03-10-2003, 05:42 PM
Required fields can't be blank at registration. You can set it to blank via the admin CP IIRC though.
Smoothie
03-10-2003, 08:18 PM
Is it possible to configure this in the admin cp, under custom profile fields? There is a maximum input line, would it be possible to add a minumum input line?
filburt1
03-10-2003, 08:23 PM
Not without hacking. You've come to the right place, though :p
Smoothie
03-11-2003, 03:33 AM
Originally posted by Xenon
for 1:
in register.php it will work somehow similar, but i'll show you how to do in member.php :)
find that:
$varname="field$profilefield[profilefieldid]";
if ($profilefield[required] and $$varname=="")
{
eval("standarderror(\"".gettemplate("error_requiredfieldmissing")."\");");
exit;
}
and change to:
$varname="field$profilefield[profilefieldid]";
if (($profilefield[required] and $$varname=="") or ($profilefieldid == 2 and $$varname != "" and strlen($$varname)<5))
{
eval("standarderror(\"".gettemplate("error_requiredfieldmissing")."\");");
exit;
}
that will disallow all inputs smaller than lenght of 5 except no input :) Ok, seems a though I won't have much help in getting this integrated into the admin cp. How about steering me in the right direction so I can call another template if users input less than the required amount of characters. :)
Xenon
03-11-2003, 09:54 AM
this :)
$varname="field$profilefield[profilefieldid]";
if ($profilefield[required] and $$varname=="")
{
eval("standarderror(\"".gettemplate("error_requiredfieldmissing")."\");");
exit;
} else if ($profilefieldid == 2 and $$varname != "" and strlen($$varname)<5) {
eval("standarderror(\"".gettemplate("error_notenoughchars")."\");");
exit;
}
now create the new template error_notenoughchars :)
Smoothie
03-11-2003, 04:59 PM
Thank you Xenon! :)
Smoothie
03-11-2003, 05:07 PM
Does the character limit apply to any? So a user could enter something like *#^@! in the locattion field? Is there a way to make it so it has to be actual letters?
Smoothie
03-11-2003, 05:23 PM
Originally posted by Xenon
this :)
$varname="field$profilefield[profilefieldid]";
if ($profilefield[required] and $$varname=="")
{
eval("standarderror(\"".gettemplate("error_requiredfieldmissing")."\");");
exit;
} else if ($profilefieldid == 2 and $$varname != "" and strlen($$varname)<5) {
eval("standarderror(\"".gettemplate("error_notenoughchars")."\");");
exit;
}
now create the new template error_notenoughchars :) Maybe it's me, but after I add that code in to member.php and then go to my profile, edit, change my location to only 3 characters, it still allows it.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.