The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Little help with If condition
I am not that great with PHP coding and struggled with it for hours now but can't get it work.
I have a plugin that created a variable for a Category in my classifieds plugin:$catid I want to show some text depending if the user is a member or not but only in a particular Category What I am trying to do If somebody looks up an item in Category 3 and he is a member (usergroup= 9) it should say "Buy this item" Category 3 and he is not a member (any usergroup besides 9) it should say "Members ONLY sale" Any other category and no matter member or not it should say "Buy this item" I tried this but didn't work <vb:if condition="$catid == 3"> <vb:if condition="$vbulletin->userinfo[usergroupid] == 9"> <font color="#FFFFFF"><b></a>Buy this item</b></font> <vb:if condition="$vbulletin->userinfo[usergroupid] <> 9"> <font color="#FFFF00"><b></a>Member ONLY sale</b></font> </vb:if> </vb:if> </vb:if> <vb:if condition="$catid <> 3"> <font color="#FFFFFF"><b></a>Buy this item</b></font> </vb:if> What am I doing wrong? I got the hint on vbulletin.com to post here Thanks for any help Michael |
#2
|
|||
|
|||
You have a mish mash of PHP and vB template script going on there.
Try this.. Code:
<vb:if condition="$catid == 3"> <vb:if condition="$bbuserinfo['usergroupid'] == 9"> <font color="#FFFFFF"><b></a>Buy this item</b></font> <vb:else /> <font color="#FFFF00"><b></a>Member ONLY sale</b></font> </vb:if> <vb:else /> <font color="#FFFFFF"><b></a>Buy this item</b></font> </vb:if> |
#3
|
|||
|
|||
Thanks for the help.
This worked fine. Maybe one more question regarding coding. How would I program for example if somebody does NOT belong to usergroup 9 AND 5 AND 3 Thanks |
#4
|
|||
|
|||
That would be:
Code:
<vb:if condition="!is_member_of($bbuserinfo, 9, 5, 3)"> </vb:if> |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|