vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   conditional in forum description (https://vborg.vbsupport.ru/showthread.php?t=294594)

Lpspider 01-30-2013 10:31 PM

conditional in forum description
 
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.

Code:

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...

Code:

<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...

Code:

<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.

Code:

<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:

Code:

<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

Quote:

Originally Posted by 87accordlxi (Post 2406332)
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:

Code:

<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

Quote:

Originally Posted by Digital Jedi (Post 2406426)
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?


All times are GMT. The time now is 03:27 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01185 seconds
  • Memory Usage 1,735KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete