View Full Version : Is he/she is my buddy? (Template conditional)
NonCompare
06-06-2006, 03:38 AM
How to make a conditional if the user viewing my profile is my buddy or not?
Any help is greatly appreciated.
nicholas
06-07-2006, 03:31 AM
*bump
OK, I really get stuck with this. So far this is what I have tried. On member.php, I add the following code: // set-up for buddylist conditional - profile view
$mybuddies = explode(' ', $userinfo['buddylist']);
if(in_array($bbuserinfo['userid'], $mybuddies))
{
$isbuddy = true;
}
else
{
$isbuddy = false;
} and on MEMBERINFO template, I test it <if condition="$isbuddy">
I'm on $userinfo[username]'s buddy list.
<else />
I'm not on $userinfo[username]'s buddy list
</if> Unfortunately, I have no luck to get it working. I really need your help on this, please...
Freesteyelz
06-07-2006, 09:20 AM
See if this link (http://www.vbulletin.com/forum/showthread.php?t=170715&highlight=buddy+conditional) helps.
nicholas
06-08-2006, 08:24 AM
Ok, I've figure it out. On member.php, add $mybuddies = explode(' ', trim($userinfo['buddylist'])); and on MEMBERINFO template,
<if condition="in_array($bbuserinfo['userid'], $mybuddies)">
I'm one of his buddy
<else />
I'm not his buddy
</if>
Just wondering, why is it that if I put the in_array() conditional on member.php it doesn't work?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.