View Full Version : conditional in forum description
Lpspider
01-30-2013, 10:31 PM
Hi,
I'd like to have a vbulletin conditional to show an additional description section for a forum advertiser/sponsor in the forum description for a specific forum. The conditional statement doesn't seem to be working though.
Regular Forum description. <vb:if condition="!is_member_of($bbuserinfo, 11,6)"><i>Sponsored Text</i>.</vb:if>
Am I doing something wrong, or is this not possible? How might I better approach this?
Lpspider
02-01-2013, 01:00 AM
K so according to vbulletin.com it can only be done with a custom mod... anyone want to take a crack?
Digital Jedi
02-01-2013, 02:23 AM
I don't really see why you couldn't use an if conditional, provided your advertisers have their own usergroup. But in addition to the userinfo if conditional, you'd need a forumid if conditional, so they only show in those forums, to those usergroups.
Lpspider
02-01-2013, 03:27 AM
Hi,
I'm not sure I understand what you mean when you say the advertisers having their own usergroup... could you rephrase it?
So instead of putting this conditional in the actual forum description box, put a conditional that shows the description in the appropriate forum template instead, and include the conditional for the usergroup and the forum id, right?
Digital Jedi
02-01-2013, 04:47 AM
The code you posted above has Usergroups specified. So I presumed you were trying to show/hide something to/from a specific Usergroups. For instance...
<vb:if condition="is_member_of($bbuserinfo, 1,2,3)">CODE HERE</vb:if>
...will only show the wrapped code to Usergroups 1, 2 and 3. But you also wanted it to only show in certain forums, so you would also use...
<vb:if condition="in_array($forum['forumid'], array(1,2,3))">CODE HERE</vb:if>
...to only show code in forums 1, 2 and 3.
More efficiently, you would combine them if you want both cases to be true.
<vb:if condition="is_member_of($bbuserinfo, 1,2,3) AND in_array($forum['forumid'], array(1,2,3))">CODE HERE</vb:if>
CODE HERE will only show to Usergroups 1, 2 and 3, and only in forums 1, 2 and 3.
And yes, they would go wherever the description for forums is displayed in the templates. (I forget which one that is, at the moment.) They are "template conditionals", so that's the only place they work.
87accordlxi
02-25-2013, 09:12 PM
I am also trying to do the same thing. I want a small line of text to be shown in a forum (actually, a category) description, but only to certain usergroups. The forum will be sponsored by an advertiser, but I only want Unregistered and partially registered usergroups to see the sponsor text.
This is the code I am using:
<vb:if condition="is_member_of($bbuserinfo, 3,1,35,21,4)">
<b>Sponsored by ADVERTISER X - </b><a href="http://www.ADVERTISER X link.com" target="_blank">ADDITIONAL SPONSOR TEXT</a><img src="http://www.IMAGE.GIF" width="1" height="1" border="0"/>
</vb:if>
The <vb:if> conditional is not working. All usergroups are seeing the text.
Digital Jedi
02-26-2013, 05:13 AM
I am also trying to do the same thing. I want a small line of text to be shown in a forum (actually, a category) description, but only to certain usergroups. The forum will be sponsored by an advertiser, but I only want Unregistered and partially registered usergroups to see the sponsor text.
This is the code I am using:
<vb:if condition="is_member_of($bbuserinfo, 3,1,35,21,4)">
<b>Sponsored by ADVERTISER X - </b><a href="http://www.ADVERTISER X link.com" target="_blank">ADDITIONAL SPONSOR TEXT</a><img src="http://www.IMAGE.GIF" width="1" height="1" border="0"/>
</vb:if>
The <vb:if> conditional is not working. All usergroups are seeing the text.
What do you mean, exactly, by "partially registered" usergroups? Because strictly speaking, you're either registered, unconfirmed or a guest. If you're a member of any one of the Usergroups defined in your if condition, you'll see it. Even if it isn't your primary Usergroup.
87accordlxi
02-26-2013, 09:53 PM
What do you mean, exactly, by "partially registered" usergroups? Because strictly speaking, you're either registered, unconfirmed or a guest. If you're a member of any one of the Usergroups defined in your if condition, you'll see it. Even if it isn't your primary Usergroup.
By "partially registered" I meant the unconfirmed and restricted usergroups. They can see pretty much everything, but cannot post. I am lumping them in with the unregistered users here as those who will see the advertisements in the category descriptions.
But when I use that code that I posted, those usergroups in the if condition see the text - but so does everyone else. The if condition is not being recognized, so vbulletin is displaying the text for everyone.
Digital Jedi
02-26-2013, 10:24 PM
I don't see any reason off hand why it shouldn't be working. What template are you using this in, and are any of the Usergroups you're using Secondary Usergroups?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.