vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   vB4 Template Conditionals List (https://vborg.vbsupport.ru/showthread.php?t=231525)

Budget101 10-03-2012 04:11 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2360168)
Code:

<vb:if condition="$bbuserinfo['styleid'] == 2">


Thank you so very much!!

Lynne 10-03-2012 04:38 PM

Quote:

Originally Posted by jluerken (Post 2370462)
How does the template conditional need to look like if I want a text to appear if the forum is closed?

SHOW NOT abc if board is closed, ELSE show def...

What do you mean the "forum is closed"? Do you mean closed for posting or what? If the whole board is closed (as you state in your next line), nobody will be able to see the forum pages anyway.

TheSupportForum 10-04-2012 09:12 AM

Quote:

Originally Posted by jluerken (Post 2370462)
How does the template conditional need to look like if I want a text to appear if the forum is closed?

SHOW NOT abc if board is closed, ELSE show def...

there is a way to turn of a created page and have a custom message show if you turn the page off

you will need to do this in the php file

example would be...

Code:


// ###### YOUR CUSTOM CODE GOES HERE #####

if (!$vbulletin->options['mymod_active'])
            {
    eval(standard_error($vbulletin->options['mymod_closedreason']));
            }

as Lynne said, if the board is off then they will see the off message from

Reason For Turning Forum Off in Admincp

jluerken 10-05-2012 05:28 AM

Quote:

Originally Posted by jluerken (Post 2370462)
How does the template conditional need to look like if I want a text to appear if the forum is closed?

SHOW NOT abc if board is closed, ELSE show def...

anyone?

BirdOPrey5 10-05-2012 05:59 PM

Quote:

Originally Posted by jluerken (Post 2370887)
anyone?

Maybe..

Code:

<vb:if condition="$vboptions['bbactive']">
FORUM ACTIVE CODE
<vb:else />
FORUM OFF CODE
</vb:if>


TheSupportForum 10-05-2012 10:34 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2371030)
Maybe..

Code:

<vb:if condition="$vboptions['bbactive']">
FORUM ACTIVE CODE
<vb:else />
FORUM OFF CODE
</vb:if>


thats vb default, the <vb:else /> is already handled in admincp
as $vboptions['bbclosedreason']

Big-K 11-01-2012 10:15 AM

Folks, Is there a conditional for member of infraction groups?

I want to show specific avatars for infraction groups. I tried the following

<vb:if condition="$bbuserinfo['infractiongroupid'] ==1" />

also tried
<vb:if condition="is_member_of($infractiongroupid, 1)" />

RedTurtle 11-04-2012 06:18 PM

Quote:

Originally Posted by Big-K (Post 2377491)
Folks, Is there a conditional for member of infraction groups?

I want to show specific avatars for infraction groups. I tried the following

<vb:if condition="$bbuserinfo['infractiongroupid'] ==1" />

also tried
<vb:if condition="is_member_of($infractiongroupid, 1)" />

I'd also like to know if this is possible, but how to do it on a plugin also. It'd be great if I could have some code execute if the user had any active infractions.

Dax IX 11-25-2012 01:06 AM

I'm trying to get link forum links to open in a new window or tab, so here's what I have in forumhome_forumbit_level2_nopost

This is the code for the forum title link, and I've added a vb:if condition:

PHP Code:

            <h2 class="forumtitle"><a href="{vb:link forum, {vb:raw forum}}" class="forumtitle"<vb:if condition="in_array($forum['forumid'], array(22))"target="_blank"</vb:if>>{vb:raw .title}</a></h2

.

vB is telling me I have a malformed conditional and the code is not working, but damned if I can figure out why.

Lynne 11-25-2012 01:50 AM

Quote:

Originally Posted by Chani (Post 2384741)
I'm trying to get link forum links to open in a new window or tab, so here's what I have in forumhome_forumbit_level2_nopost

This is the code for the forum title link, and I've added a vb:if condition:

PHP Code:

            <h2 class="forumtitle"><a href="{vb:link forum, {vb:raw forum}}" class="forumtitle"<vb:if condition="in_array($forum['forumid'], array(22))"target="_blank"</vb:if>>{vb:raw .title}</a></h2

.

vB is telling me I have a malformed conditional and the code is not working, but damned if I can figure out why.

You need to tell us *exactly* where you are adding this so we may try it ourselves and see what is going on.

Dax IX 11-25-2012 02:20 AM

I'm sorry, I thought it was pretty obvious. It's within the forum title link and the conditional I added is the only one in the statement, but here's my whole code for forumhome_forumbit_level2_nopost

PHP Code:

<li class="forumbit_nopost {vb:raw forum.statusicon} L2" id="cat{vb:raw forum.forumid}">
    <
div class="forumrow table"><div class="foruminfo td">
                    <
img src="{vb:stylevar imgdir_statusicon}/category_forum_{vb:raw forum.statusicon}.png" class="forumicon" id="forum_statusicon_{vb:raw forum.forumid}" alt="" />
        <
div class="forumdata">
<
div class="datacontainer">
            <
h2 class="forumtitle"><a href="{vb:link forum, {vb:raw forum}}" class="forumtitle"<vb:if condition="in_array($forum['forumid'], array(22,24))"target="_blank"</vb:if>>{vb:raw .title}</a></h2>
            <
vb:if condition="$show['forumdescription']"><class="forumdescription">{vb:raw forum.description}</p></vb:if>
            <
vb:if condition="!$show['collapsable_forums']"><a href="javascript://" class="collapsegadget"></a></vb:if>
            <
vb:if condition="$show['subforums']">
                {
vb:raw forum.subforums}
            </
vb:if>
        </
div>
</
div>
    </
div></div>
    <
vb:if condition="$childforumbits">
        <
ol id="c_cat{vb:raw forum.forumid}" class="childforum">
            {
vb:raw childforumbits}
        </
ol>
    </
vb:if>
</
li

Thanks! :)

--------------- Added 24 Nov 2012 at 23:09 ---------------

The conditional I added was this:

PHP Code:

<vb:if condition="in_array($forum['forumid'], array(22,24))"target="_blank"</vb:if> 


BirdOPrey5 11-25-2012 01:06 PM

Not that it should make a difference but did you try putting spaces outside the conditional?

Code:

"forumtitle" <vb:if condition="in_array($forum['forumid'], array(22,24))"> target="_blank"</vb:if> >{vb:raw .title}</a></h2>

Lynne 11-25-2012 03:37 PM

This worked fine for me:

HTML Code:

<h2 class="forumtitle"><a href="{vb:link forum, {vb:raw forum}}" class="forumtitle" <vb:if condition="in_array($forum['forumid'], array('22','24'))"> target="_blank"</vb:if> >{vb:raw forum.title}</a></h2>

Dax IX 11-25-2012 04:57 PM

Thank you both. :)

I got it to work by posting the same code in forumhome_forumbit_level2_post

For some reason I was thinking it was using forumhome_forumbit_level2_nopost

Thanks again! :)

Nirjonadda 12-08-2012 02:53 PM

How to Usergroups able to view but can not use ?

Code:

<vb:if condition="is_member_of($bbuserinfo, 6,7,9,10,16)">
  code here
  </vb:if>


Ary Braga 12-19-2012 12:59 AM

How do I get these two conditional work properly in a single task. I can not make it work.

Can someone help me?

PHP Code:

<vb:if condition="is_member_of($bbuserinfo, 5,6,7,42,43)">
                       <
vb:if condition="$post['currentactivity']">{vb:raw post.currentactivity}
    </
vb:if>
            </
vb:if> 


BirdOPrey5 12-19-2012 07:41 PM

You just use AND to join two conditions that both must be true.

Code:

<vb:if condition="is_member_of($bbuserinfo, 5,6,7,42,43) AND $post['currentactivity']">
{vb:raw post.currentactivity}
 </vb:if>


AndrewSimm 12-27-2012 11:47 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2391724)
You just use AND to join two conditions that both must be true.

Code:

<vb:if condition="is_member_of($bbuserinfo, 5,6,7,42,43) AND $post['currentactivity']">
{vb:raw post.currentactivity}
 </vb:if>


I tried using this in a CMS widget and it would not work. Any ideas?

BirdOPrey5 12-29-2012 07:51 PM

Do you mean a widget template? Because template conditionals won't work in widget PHP code.

My guess is regardless, $post is a variable only available inside posts (the postbit template) and would not be available in any CMS template, so it would always return FALSE.

AndrewSimm 12-31-2012 12:27 AM

Quote:

Originally Posted by BirdOPrey5 (Post 2393448)
Do you mean a widget template? Because template conditionals won't work in widget PHP code.

My guess is regardless, $post is a variable only available inside posts (the postbit template) and would not be available in any CMS template, so it would always return FALSE.

I see, so there is no way I could hide a block ad that I insert into a widget?

Easy5s.net 01-20-2013 10:39 AM

in temp forumhome_lastpostby

Quote:

<vb:if condition="in_array($forum['forumid'], array(12))">[{vb:raw lastpostinfo.dateline}]</vb:if>
But not work, pls hep me :(

induslady 02-13-2013 02:38 PM

Hi All,
I would want to plugin an optimizer code only in this forum page
- http://www.indusladies.com/forums/married-life/

the code will go only in this forumdisplay page and not even in the showthread pages of htis forum - threads in this forum.

Can anyone let me know the template conditional to do the same?
Thanks.

K4GAP 02-13-2013 02:49 PM

This is a must have for folks like me that are trying to learn so that they can be self sufficient in taking care of their site.

Thanks !

Digital Jedi 02-13-2013 03:21 PM

Quote:

Originally Posted by induslady (Post 2403999)
Hi All,
I would want to plugin an optimizer code only in this forum page
- http://www.indusladies.com/forums/married-life/

the code will go only in this forumdisplay page and not even in the showthread pages of htis forum - threads in this forum.

Can anyone let me know the template conditional to do the same?
Thanks.

You use the Show in one forum example, using that forum's ID number in place of X.

Big-K 02-19-2013 04:27 PM

Hello, I'm looking for a conditional that will highlight a reported post (in report thread), but not yet replied in the report thread.

The following code works to show a reported post
Code:

<vb:if condition="$post['reportthreadid'] > 0"></vb:if>
The problem is how to add the conditional that this is the ONLY post on that thread I tried replacing ">1" with "=1", but that does not work.

Lynne 02-19-2013 05:30 PM

Quote:

Originally Posted by Big-K (Post 2405232)
Hello, I'm looking for a conditional that will highlight a reported post (in report thread), but not yet replied in the report thread.

The following code works to show a reported post
Code:

<vb:if condition="$post['reportthreadid'] > 0"></vb:if>
The problem is how to add the conditional that this is the ONLY post on that thread I tried replacing ">1" with "=1", but that does not work.

I'm afraid I don't understand what you are trying to do and what template you are trying to do it in.

Big-K 02-19-2013 07:50 PM

Quote:

Originally Posted by Lynne (Post 2405246)
I'm afraid I don't understand what you are trying to do and what template you are trying to do it in.

Lynne,

I'm in postbit legacy.

What I'm trying to do is to highlight posts to let users know that the post has been reported and waiting moderators review. This will prevent users from quoting or replying to such post until someone has taken a look.

We have a dedicated forum for reported posts. So What I want to do is create a conditional in postbit that will
1) highlight the reported post (the code I posted earlier does that)
<vb:if condition="$post['reportthreadid'] > 0">THIS POST IS REPORTED</vb:if>
2) remove the highlight once there is a reply to the report in reported post forum (I was hoping the ">1" will do that, but that's not the case)

Does this explanation help please?

Lynne 02-19-2013 11:44 PM

Quote:

Originally Posted by Big-K (Post 2405279)
2) remove the highlight once there is a reply to the report in reported post forum (I was hoping the ">1" will do that, but that's not the case)

Does this explanation help please?

That is going to require a plugin to find the reported post thread and see how many replies there are to it. You cannot use just a simple template condition to check it.

Big-K 02-20-2013 04:22 AM

Quote:

Originally Posted by Lynne (Post 2405320)
That is going to require a plugin to find the reported post thread and see how many replies there are to it. You cannot use just a simple template condition to check it.

Thank you Lynne. Grateful if you can help with the plugin, but I understand if you cant.

Digital Jedi 02-20-2013 04:22 PM

Quote:

Originally Posted by Big-K (Post 2405365)
Thank you Lynne. Grateful if you can help with the plugin, but I understand if you cant.

If you haven't already, you can try and start a new thread in the modification request section, just so we don't go off track in this thread. It probably depends on how difficult this is before you'll get a reply. I'm not certain myself.

tareqbd 03-01-2013 04:16 PM

I want to use day conditional. Please advise how to use it.
PHP Code:

<vb:if condition="($day == 'Friday')">
Today is Friday.
<
vb:else />
It's not Friday
</vb:if> 


Lynne 03-01-2013 04:55 PM

Quote:

Originally Posted by tareqbd (Post 2407209)
I want to use day conditional. Please advise how to use it.
PHP Code:

<vb:if condition="($day == 'Friday')">
Today is Friday.
<
vb:else />
It's not Friday
</vb:if> 


I don't think it will be a simple template condition. You will need a plugin first to get the day and then you may assign it to a variable to use in your template.

tareqbd 03-01-2013 05:24 PM

Quote:

Originally Posted by Lynne (Post 2407217)
I don't think it will be a simple template condition. You will need a plugin first to get the day and then you may assign it to a variable to use in your template.

Thank you. I will try as per your advise.

How can I get registration on/of condition.
Is it like <vb:if condition="$vboptions== 1"> ?
I want to use registration on/off condition. Please help.

Lynne 03-01-2013 05:46 PM

that would be the variable $vboptions['bbactive']

tareqbd 03-01-2013 05:50 PM

Quote:

Originally Posted by Lynne (Post 2407234)
that would be the variable $vboptions['bbactive']

But it's regarding registration active/inactive. Is it the same please?
Is it like <vb:if condition="$vboptions>registration['active']">

Lynne 03-01-2013 08:20 PM

Quote:

Originally Posted by tareqbd (Post 2407235)
But it's regarding registration active/inactive. Is it the same please?
Is it like <vb:if condition="$vboptions>registration['active']">

I thought that was what you were asking about. That is the option that determines whether registration is turned on or off, or active or inactive.
Quote:

Originally Posted by tareqbd (Post 2407224)
Thank you. I will try as per your advise.

How can I get registration on/of condition.
Is it like <vb:if condition="$vboptions== 1"> ?
I want to use registration on/off condition. Please help.


Hilary 04-06-2013 07:48 PM

Hello Lynne and everyone,

The smiliebox is causing havoc for me, so there are a couple of pages where I'd like it not to appear. I've worked out how to make it disappear for one of them, but I don't know how to make this happen for both.

Editing the template editor_ckeditor, every time it says 'if smiliebox' I add an extra condition:
<vb:if condition="$smiliebox" AND condition="THIS_SCRIPT != 'profile'">
That fixes it for the edit signature box. Smiliebox gone, editor full width.

But how can I make it so that the condition applies if there is a smiliebox and if I'm not on either the profile page or the showwiki page?

Huge thanks for any help.

~~~~~

Update:

I was using 'AND' because an earlier post on this thread said it was possible. Well... at least for me, it didn't work. I tried it both with and without the 'condition=' following. The result's always the same: only the final condition before the > is applied, none of the others. The example I gave above did indeed remove the smiliebox from the profile, but it had removed the first condition (which meant the smiliebox was appearing in all other editors eg quickreply). Didn't notice that until later...

The only way I found to apply three conditions was to create three nested 'ifs'. Not pretty, but it works.

Thanks to BBR-APBT for the original post!

GameOverViper 05-03-2013 09:46 PM

I'm wanting to hide some coding for my advertisements for a specific usergroup. How do I do this?

I originally used the show for usergroup code, but apparently that's no longer working right.

Hilary 05-04-2013 10:46 AM

What happens with
Code:

<vb:if condition!="is_member_of($bbuserinfo, 1)">ad code here</vb:if>
? (Where '1' is the number of the usergroup you don't want to see the ads, of course.) Not that I've tried this, but I have the positive version (showing certain links only to a given usergroup) and that's working fine in vB 4.

Lynne 05-04-2013 06:35 PM

Quote:

Originally Posted by Hilary (Post 2419883)
What happens with
Code:

<vb:if condition!="is_member_of($bbuserinfo, 1)">ad code here</vb:if>
? (Where '1' is the number of the usergroup you don't want to see the ads, of course.) Not that I've tried this, but I have the positive version (showing certain links only to a given usergroup) and that's working fine in vB 4.

It would actually be like this:

PHP Code:

 <vb:if condition="!is_member_of($bbuserinfo, 1)">ad code here</vb:if> 



All times are GMT. The time now is 12:53 AM.

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05112 seconds
  • Memory Usage 1,891KB
  • 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
  • (12)bbcode_code_printable
  • (1)bbcode_html_printable
  • (8)bbcode_php_printable
  • (23)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete