PDA

View Full Version : "N/A" when a Profile field is not filled


FeDe
12-30-2002, 05:57 PM
Hey :D. I've just searched for a hack like this one I'm requesting but couldn't find any.. *heh* That's why I'm requesting it :D.

I'd like that when in the profile, fields such as the Optional Information ones or the Additional Information ones aren't filled, a "Not Available" to appear in the profile.


Hope you guys can help me! :D

Thanks :)

NTLDR
12-30-2002, 06:23 PM
There are a few hacks that do certain fields. All you need to do if go through member.php and find the variables (like $userinfo[icq] for ICQ) and add what you want to be displayed instead of a blank field.

Eg $userinfo[icq]=''; would become $userinfo[icq]='N/A';

FeDe
12-30-2002, 06:29 PM
KK, Thanks :). I'll try that now.

FeDe
12-30-2002, 06:57 PM
It worked for the ICQ, AIM and Yahoo fields, but I couldn't find any way of doing the same with the custom fields.. Any idea? :$

Thanks for the help btw :).

Sebastian
12-30-2002, 07:12 PM
i think custom fields are store in the database.

NTLDR
12-30-2002, 07:28 PM
Yes, custom ones are stored in the database, in the userfields table.

Untest but should work, in member.php replace:

$profilefield[value]=$userinfo[$profilefieldname];

With:

if ($userinfo[$profilefieldname]=='') {
$profilefield[value]="N/A";
} else {
$profilefield[value]=$userinfo[$profilefieldname];
}

FeDe
12-30-2002, 07:48 PM
It didn't work :(, but there were no errors and if the custom fields were filled, the info did appear.

NTLDR
12-30-2002, 08:10 PM
It should work fine, I just tested the code and the results were as expected. You did replace the code and not add before or after it?

FeDe
12-30-2002, 11:00 PM
Yes, I did replace it. Just tried again, and it won't work :S.

Chris M
12-30-2002, 11:22 PM
It does work:)

What version of vB are you running?

Satan

FeDe
12-30-2002, 11:30 PM
Using 2.2.9.

This is how my code is right now:

// get extra profile fields
$customfields = '';
$profilefields=$DB_site->query("SELECT profilefieldid,required,title
FROM profilefield
WHERE hidden=0
ORDER BY displayorder");
while ($profilefield=$DB_site->fetch_array($profilefields)) {
if ($backcolor=="{firstaltcolor}") {
$backcolor="{secondaltcolor}";
$bgclass = "alt2";
} else {
$backcolor="{firstaltcolor}";
$bgclass = "alt1";
}
$profilefieldname="field$profilefield[profilefieldid]";

if ($userinfo[$profilefieldname]=='') {
$profilefield[value]="N/A";
} else {
$profilefield[value]=$userinfo[$profilefieldname];

}
eval("\$customfields .= \"".gettemplate("getinfo_customfields")."\";");

}

eval("dooutput(\"".gettemplate("getinfo")."\");");

}

FeDe
01-01-2003, 10:56 PM
*bump* :$ hehhe.