View Full Version : Unfilled fields in Profile not displayed...
tpearl5
08-26-2001, 01:27 AM
Can this be done?
tubedogg
08-26-2001, 01:59 AM
On which page?
tpearl5
08-26-2001, 02:06 AM
More specifically, on the member profile pages in custom and normal fields which are not required and are not filled in by the user.
tubedogg
08-26-2001, 02:32 AM
Yep, it's possible. You'll have to create templates for each that you want to show/not show and copy out the info from the getinfo template for that row and add a bit to member.php.
For example, if I don't want Location to show if it's empty, I'd do the following:
1) Create a new template called getinfo_location with the following in it:
<tr>
<td bgcolor="{firstaltcolor}"><normalfont><b>Location:</b></normalfont></td>
<td bgcolor="{firstaltcolor}"><normalfont>$userinfo[field2]</normalfont></td>
</tr>
2) If this field was already in the getinfo template (this was a slightly bad example cause it's a custom field that falls under the guise of $customfields in the getinfo template) I'd remove the whole row from the template and replace it with $userinfo[location] - but in this case we just need to add $userinfo[location] somewhere in the getinfo template.
3) In member.php find
eval("\$customfields .= \"".gettemplate("getinfo_customfields")."\";");
}
and add right after it
if ($userinfo[field2]!="") {
eval("\$userinfo[location] .= \"".gettemplate("getinfo_location")."\";");
} else {
$userinfo[location="";
}
Just repeat for any other things you want to display/not display.
tpearl5
08-26-2001, 02:42 AM
Seems easy enough! I'll try that out tomorrow when I'm awake. This should be a new feature for 2.1 ! No doubt...
Weasel
12-29-2001, 02:21 PM
That's not easy, in fact thats the most hacked-up slackjaw thing i ever saw. Isn't there a way that will work for ALL fields? :confused:
Tim Wheatley
08-31-2002, 04:35 PM
This is what I've put in my functions.php:
if ($post[field2]!="") {
eval("\$post[field2] = \"".gettemplate("postbit_location")."\";");
} else {
$post[field2]="";
}
if ($post[joindate]!="") {
eval("\$post[joindate] = \"".gettemplate("postbit_registered")."\";");
} else {
$post[joindate]="";
}
if ($post[posts]!="" and $post[posts]!="0") {
eval("\$post[posts] = \"".gettemplate("postbit_posts")."\";");
} else {
$post[posts]="";
}
Then make three new templates, postbit_location, postbit_posts and postbit_registered.
All they should contain is (example):
Posts: $post[posts]<br>
What all the above does it makes the stats within postbit invisible when someone hasn't made any posts, hasn't filled in a location, or is a guest (so of course hasn't filled any of the info in).
Boofo
08-31-2002, 06:17 PM
There's a hack out just for the customfields not showing up in the profile page if they are empty. It is by AFTERLAB and the hack is called "Hide Unentered Fields".
Chris M
08-31-2002, 06:43 PM
Thank you Boofo:)
Satan
Boofo
08-31-2002, 07:11 PM
You're welcome there, Chris. ;)
Originally posted by hellsatan
Thank you Boofo:)
Satan
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.