Log in

View Full Version : Custom Field - Inputting Info Automatically.


dogbomb
11-26-2002, 08:07 PM
Hey.

I have a custom profile field on my forums. It is not required, not hidden and not editable.

When someone signs up to the site, I want to set this at a start value of 1...

What would be the best way to do this?

profilefieldid=5 if that info helps.

Thanks in advance for any help or advice.

Xenon
11-27-2002, 11:45 AM
open your register.php and find this: while ($profilefield=$DB_site->fetch_array($profilefields)) {
$havefields = 1;
$varname="field$profilefield[profilefieldid]";
if ($profilefield[required] and $$varname=="") {
eval("standarderror(\"".gettemplate("error_requiredfieldmissing")."\");");
exit;
}
$$varname=censortext($$varname);
// ENTER ANY CUSTOM FIELD VALIDATION HERE!
//Make sure user didn't try to bypass the maxchars for the fields
$$varname=substr($$varname,0,$profilefield[maxlength]);
$userfieldsnames.=",field$profilefield[profilefieldid]";
$userfields.=",'".addslashes(htmlspecialchars($$varname))."'";
}


change it to: while ($profilefield=$DB_site->fetch_array($profilefields)) {
$havefields = 1;
$varname="field$profilefield[profilefieldid]";
if ($profilefield[required] and $$varname=="") {
eval("standarderror(\"".gettemplate("error_requiredfieldmissing")."\");");
exit;
}
$$varname=censortext($$varname);
// ENTER ANY CUSTOM FIELD VALIDATION HERE!
//Make sure user didn't try to bypass the maxchars for the fields
$$varname=substr($$varname,0,$profilefield[maxlength]);
$userfieldsnames.=",field$profilefield[profilefieldid]";
if($profilefield[profilefieldid]==5) $$varname=1;
$userfields.=",'".addslashes(htmlspecialchars($$varname))."'";
}

dogbomb
11-27-2002, 01:03 PM
That kills register.php :|

Xenon
11-27-2002, 01:10 PM
can you be a bit more specific?

error?

which message?

dogbomb
11-27-2002, 01:30 PM
No error... gives out a blank page.

Xenon
11-27-2002, 06:02 PM
hmm, cannot be normally
perhaps you have uploaded the file incorrectly...

try it again, be sure it's saved as pure ASCII

dogbomb
11-27-2002, 06:04 PM
I did. I even tried editing it directly in the shell.

I got the page to show when I changed

if($profilefield[profilefieldid]==5]) $$varname=1;

to:

if($profilefield[profilefieldid]==5) $$varname=1;

but it still didn't work :(

dogbomb
11-30-2002, 12:25 PM
As yet I am unable to fix this... anyone got any more ideas?