View Full Version : I think this is a 5 min job for a smart PHP'er!
PicoDeath
09-23-2008, 06:24 PM
I want to display a certain html table on someones user profile ONLY if they've entered something in a certain custom profile feild.
Thanks.
ercollins
09-23-2008, 06:26 PM
um, that does not explain much, maybe more detail?
SEOvB
09-23-2008, 07:20 PM
<if condition="$profile[fieldX]">
Html code
</if>
PicoDeath
09-24-2008, 04:13 PM
<if condition="$profile[fieldX]">
Html code
</if>
Thanks, I'm trying to do it just to show random text for the moment however it doesn't appear to be displaying anywhere...
The ID of this custom feild is 6, do I need to change profile to something else?
nexialys
09-24-2008, 05:03 PM
$profile[field6]
ercollins
09-24-2008, 05:03 PM
it should look like $profile[field6]
Make sure you are using the actual field ID number and not the Sort display number.
also make sure you have something in that profile field.
PicoDeath
09-24-2008, 05:10 PM
The ID is definetly 6 and it's order is 5.
http://www.gamernade.com/forums/members/picodeath.html
<if condition="$profile[field6]">
<td>What the hell?</td>
</if>
Still not showing, the feild I'm basing it on is the Xbox360 gamertag.
Which has something in it, so it should show.. no?
Lynne
09-24-2008, 05:16 PM
Why don't you tell us exactly what template you are adding this to and post the exact code you are using (and a little around it so we can see where you are posting it).
PicoDeath
09-24-2008, 05:25 PM
MEMBERINFO > MEMBERINFO
<td class="panelsurround" align="center">
<div class="panel">
<div align="$stylevar[left]">
<div class="fieldset">
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
<if condition="$profile[field6]">
<td>What the hell?</td>
</if>
<if condition="!$show['contactlinks']">
<tr>
<td><strong><phrase 1="$userinfo[username]">$vbphrase[x_has_no_contact_info]</phrase></strong></td>
</tr>
</if>
<if condition="$show['homepage']">
<tr>
<td>
$vbphrase[home_page]:<br />
<a href="$userinfo[homepage]" target="_blank" dir="ltr">$userinfo[homepage]</a>
</td>
</tr>
</if>
Not sure how little you want :p
Lynne
09-24-2008, 05:34 PM
Change this:
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
<if condition="$profile[field6]">
<td>What the hell?</td>
</if>
to this:
<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
<if condition="$profile[field6]">
<tr>
<td>What the hell?</td>
</tr>
</if>
And see if that works. You were using incorrect html and that can screw things up.
PicoDeath
09-24-2008, 06:20 PM
I tried it both ways before to see if anything happend, I tried again just to make sure and it still doesn't show.
Lynne
09-24-2008, 07:33 PM
Have you tried using $userinfo[field6] instead?
PicoDeath
09-25-2008, 10:08 AM
That works wonders Lynne, thanks for the help!
Marco van Herwaarden
09-25-2008, 11:09 AM
$userinfo will probably contain the settings for the user browsing the profile, not for the user owning that profile.
Try using $show[field6] instead of $profile/$userinfo.
Lynne
09-25-2008, 02:30 PM
$userinfo will probably contain the settings for the user browsing the profile, not for the user owning that profile.
Try using $show[field6] instead of $profile/$userinfo.
Are you sure, Marco? My cheatsheet (which I admit could be wrong!) says $userinfo for the user you are viewing and $bbuserinfo for you the browser/viewer.
To the OP, one way to check.... you know what *your* field6 should be, is that what is showing up in the page?
Marco van Herwaarden
09-25-2008, 03:17 PM
I am basing my assumption (have not even looked in the code) on the other conditions in the same template, they all use $show.
PicoDeath
09-25-2008, 03:43 PM
Fixed
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.