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)

kether1 06-24-2011 08:51 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2212280)
Sorry man... VBA Dynamics is a commercial mod I just don't have access to so I don't know how it's designed or what fields may be available.

If there is a php hook available somewhere you could make a plugin with this code, it will print out all available fields for $entry and see if any of them match the userid.

Code:

echo "<pre>";
print_r ($entry);
echo "</pre>";

But don't do it while your forum is on (use a test forum if you have one) otherwise everyone will see the code output.

Thanks for your efforts! I am grateful!

Regards,
Kether

--------------- Added [DATE]1309015535[/DATE] at [TIME]1309015535[/TIME] ---------------

Just a follow-up update: I finally figured it out with your help, Joe. I went to the template and just started deleting bits and checking to see what was displayed. I found the bit that was causing the information to be displayed to everyone even though we told it to only display to the admin and user. After removing that code. It all worked!! Thanks again for your help. I appreciate it very much.

Kether

induslady 06-27-2011 07:46 AM

Hello,

Am looking for a template conditional for Blog pages.

I tried this:

Quote:

<vb:if condition="THIS_SCRIPT == 'blog'">

but this works only for the blog home page.

I would want a template conditional that applies to all the blog pages.

Thanks.

Marv 06-30-2011 08:10 AM

Quote:

Originally Posted by BirdOPrey5 (Post 2191385)
There's no condition specifically for 2nd posts but if you set your forum to a set number of posts per page you could make a condition like:

Code:

<vb:if condition="$post[postcount] == 2 OR $post[postcount] == 12  OR$post[postcount] == 22 OR $post[postcount] == 32 OR $post[postcount] == 42 OR $post[postcount] == 52 OR $post[postcount] == 62">
</vb:if>

...and so on... Assuming 10 posts per page- Yeah at some point the condition won't work anymore but how many threads really go X number of pages anyway. I assume you want it to show an ad so if it works in 95% of thread pages it should be good enough.

An approach I have tested out but collided with other ads around the last post on a thread, if the showthread page contains only two or three postings. To overwhelming and filled with ads.

I try to modify and create the ad-placements with a precheck, wether there are more then X posts on a showthread page or not. Dependencies:
  • if the visitor is a guest
  • if the ad placement is the X post on this showthread page as seen in the browser
  • if the page (not the whole thread) shows at least Y postings (to avoid that the whole page is looking like an adfarm)
PHP Code:

<vb:if condition="$show['guest']">
    <
vb:if condition="$post['postcount'] % $vboptions['maxposts'] == X"
        [
CONTENT HERE
      
    </
vb:if> 
</
vb:if> 

That?s how it looks like so far - but I can?t find anything that could help me with the last if statement. Does anyone has an idea how this could be done? Isn?t there something in vB that can be used for that? May be I?m just to blind but that damn thing ruined my whole day yesterday. I would be glad someone could lead a blind and help me out of this mess..

Any help appreciated.

induslady 06-30-2011 09:11 AM

Hello,

Am looking for a template conditional:

In Showthread page - postbit, the username of the poster needs to be in red color if she belongs to a particular usergroup id - 34, I tried this

PHP Code:

<vb:if condition="is_member_of($post, 34)"
<
span style="color:red;"User name goes here</span>
</
vb:if> 

But it does not seem to be working and I did the above template conditional in memberaction_dropdown

Let me know the correct conditional that needs to go there.

BTW the conditional to check if the page is a blog page including the blog index use the below:

PHP Code:

<vb:if condition="in_array(THIS_SCRIPT, array('blog' , 'entry','blog_post', 'misc'))">
Code goes here
</vb:if> 

Thanks.

Marv 06-30-2011 09:26 AM

Quote:

Originally Posted by induslady (Post 2214953)
In Showthread page - postbit, the username of the poster needs to be in red color if she belongs to a particular usergroup id - 34

If I don?t get you wrong, that?s already a built-in feature. Check the settings of the usergroup 34 in the usergroup-settings, 3rd checkbox should be the one you are looking for.

induslady 06-30-2011 12:29 PM

Hello Marv,

Thanks for the response. Guess you are talking about the "Username HTML markup".

But this user has the usergroup id - 34 as her secondary user group ( and not primary user group). Hence the HTML markup - color code set in the usergroup setting is not output in the postbit.

let me know how to obtain this.

Thanks in advance.

kh99 06-30-2011 01:02 PM

I think the condition is correct. Are you using post.musername or post.username? post.musername includes the group markup, which is probably overriding your color, so try post.username.

BirdOPrey5 06-30-2011 02:27 PM

Quote:

Originally Posted by induslady (Post 2214953)
Hello,

Am looking for a template conditional:

In Showthread page - postbit, the username of the poster needs to be in red color if she belongs to a particular usergroup id - 34, I tried this

PHP Code:

<vb:if condition="is_member_of($post, 34)"
<
span style="color:red;"User name goes here</span>
</
vb:if> 

But it does not seem to be working and I did the above template conditional in memberaction_dropdown

Let me know the correct conditional that needs to go there.

BTW the conditional to check if the page is a blog page including the blog index use the below:

PHP Code:

<vb:if condition="in_array(THIS_SCRIPT, array('blog' , 'entry','blog_post', 'misc'))">
Code goes here
</vb:if> 

Thanks.

I don't think $post can be used in memberaction_dropdown. I don't know what the alternative would be either- would probably need some custom plugins I think.

memberaction_dropdown is called from many different templates, not just the postbit.

kh99 06-30-2011 02:59 PM

Oh, good point Joe, I saw postbit and missed memberaction_dropdown. Sorry induslady.

ETA: Actually I think you might be able to substitute $memberinfo for $post. You still may have to use username instead of musername.

baghdad4ever 07-01-2011 04:24 PM

How can I insert a banner in the first post of the every pages of the thread ?

BirdOPrey5 07-01-2011 05:25 PM

Quote:

Originally Posted by baghdad4ever (Post 2215511)
How can I insert a banner in the first post of the every pages of the thread ?

Open postbit template...

find {vb:raw post.message}

Either directly above it or below it add this code:

Code:

<vb:if condition="$post['isfirstshown']">
BANNER CODE HERE
</vb:if>


baghdad4ever 07-01-2011 07:23 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2215547)
Open postbit template...

find {vb:raw post.message}

Either directly above it or below it add this code:

Code:

<vb:if condition="$post['isfirstshown']">
BANNER CODE HERE
</vb:if>



thanks alot

it is worked perfectly:D

is there any way to put the banner between the content of thread?

ie: among words of post not before nor after


thanks again

BirdOPrey5 07-01-2011 08:39 PM

Not with a template conditional... that would require some custom coding beyond the realm of this article.

baghdad4ever 07-01-2011 09:09 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2215622)
Not with a template conditional... that would require some custom coding beyond the realm of this article.

thanks alot for your kind reply

flbutterflyz 07-07-2011 07:34 PM

Hi,

I created a profile field that I'd like each usergroup to view but only want 3 usergroups to use. How do I go about that in postbit legacy? Here's what I have so far:

Code:

<vb:if condition="$post[field27] != ''"><img src="images/favthings/{vb:raw post.field27}.png" title="Favorite Things" align="left" border="0"  /></vb:if>

HMBeaty 07-07-2011 07:37 PM

Quote:

Originally Posted by flbutterflyz (Post 2217896)
Hi,

I created a profile field that I'd like each usergroup to view but only want 3 usergroups to use. How do I go about that in postbit legacy? Here's what I have so far:

Code:

<vb:if condition="$post[field27] != ''"><img src="images/favthings/{vb:raw post.field27}.png" title="Favorite Things" align="left" border="0"  /></vb:if>

HTML Code:

<vb:if condition="is_member_of($bbuserinfo, 1,2,3) AND $post[field27] != ''"><img src="images/favthings/{vb:raw post.field27}.png" title="Favorite Things" align="left" border="0"  /></vb:if>
And change "1,2,3" to the 3 usergroup id's you wish to show the code to

flbutterflyz 07-08-2011 12:10 AM

Thank you SO much!! :)

HMBeaty 07-08-2011 12:31 AM

Quote:

Originally Posted by flbutterflyz (Post 2217975)
Thank you SO much!! :)

No problem :)

flbutterflyz 07-26-2011 05:23 PM

^^Regarding the same code above, is there a way to let the image show to everyone but only usable for certain usergroups? Meaning the image will only be active in 4 usergroups' postbit but everyone can view the image.

Not sure if I'm explaining it well...

mrderanged 08-04-2011 05:05 PM

I'm trying to make the tab to collapse the sidebar only visible to paid members, I want everyone else to be unable to collapse it.

Would this be the correct edit to the forumhome template?

Code:

<a id="sidebar_button_link" href="#">
                <vb:if condition="is_member_of($bbuserinfo, 9,10,11)">
                        <vb:if condition="$show['sidebarposition'] == 'left'">
                        <img id="sidebar_button" src="{vb:stylevar imgdir_misc}/tab-collapsed-left.png" alt="" />
                        <vb:else />
                        <img id="sidebar_button" src="{vb:stylevar imgdir_misc}/tab-collapsed.png" alt="" />
                        </vb:if>
                </vb:if>       
                </a>


thanks in advance

Divvy 08-13-2011 09:01 AM

Hello guys,

Maybe someone can help me...

I have this code:
PHP Code:

$template_hook['postbit_userinfo_right_after_posts'] .= '<div style="clear:both;" class="left"><a target="_blank" href="'.$mylink.''.$usernumber.'">'.$mylinktitle.'</a></div>'

That shows a link at postbit with all topics from the user at a two specific forums.

I need that:
- the link only shows when the user have threads at least in one of that two forums.
- If not, the link doesn't appear.

Is there any syntax for this?

Or else, I had another idea...
The links only appear If the user belongs to a specific group.

BirdOPrey5 08-13-2011 09:45 AM

Quote:

Originally Posted by Divvy (Post 2232927)
Hello guys,

Maybe someone can help me...

I have this code:
PHP Code:

$template_hook['postbit_userinfo_right_after_posts'] .= '<div style="clear:both;" class="left"><a target="_blank" href="'.$mylink.''.$usernumber.'">'.$mylinktitle.'</a></div>'

That shows a link at postbit with all topics from the user at a two specific forums.

I need that:
- the link only shows when the user have threads at least in one of that two forums.
- If not, the link doesn't appear.

Is there any syntax for this?

Or else, I had another idea...
The links only appear If the user belongs to a specific group.

You're posting PHP code- that has nothing to do with template conditionals. I suggest asking in the VB4 Programming forum, it's not part of this discussion.

8thos 08-25-2011 01:03 AM

How do you use conditionals to hide a thread by use of it's thread id or a combination of thread ids?

Say for instance, I have a thread in a forum that I don't want guests to view but I want guests to be able to view the whole subforum and it's other threads.

Crow 08-25-2011 05:31 PM

Awesome, thanks!

Dirt Bike Addict 09-12-2011 02:26 PM

Is this the most efficient way to do a multi-THIS_SCRIPT if conditional?

Code:

<vb:if condition="in_array(THIS_SCRIPT, array('search' , 'calendar' , 'usercp' , 'online' , 'faq' , 'album' , 'profile' , 'member' , 'misc' , 'subscription' , 'private' , 'showgroups'))">
Show on the above pages/scripts
<vb:else />
Show on all other pages/scripts
</vb:if>


BirdOPrey5 09-12-2011 04:15 PM

^yes, that is how I would do it.

Dirt Bike Addict 09-12-2011 04:40 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2244931)
^yes, that is how I would do it.

Awesome, thanks Joe!

It might not be a bad idea to have that added to the article, it took me awhile to figure out how to do. :mad:

VinavB 09-13-2011 07:20 AM

any condition for article in CMS ???

Budget101 11-21-2011 03:21 PM

What is the correct syntax for a conditional that is a member with at least 'X' posts/threads made in the last 30 days?

Any ideas? TIA!

BirdOPrey5 11-21-2011 09:02 PM

You cannot use a template conditional for posts within x days, you would need a plugin to calculate this value.

Loversama 01-31-2012 02:47 PM

Quote:

Originally Posted by flbutterflyz (Post 2225277)
^^Regarding the same code above, is there a way to let the image show to everyone but only usable for certain usergroups? Meaning the image will only be active in 4 usergroups' postbit but everyone can view the image.

Not sure if I'm explaining it well...

<vb:if condition="$post[usergroupid]==17">


;D

AshMagic 02-07-2012 02:35 PM

What is the variable for displaying the total amount of registered members on vBulletin 4?

inigo 02-10-2012 05:45 AM

I would like to insert some ad code in the CMS home, between the articles preview, but I would like to know the conditional to show this ads only after the preview article position I like.

I have the 1+2 colums selected, so i wouuld like to show,

1 article_preview,
AD CODE
2 article preview 3 article preview
4article preview 5 article preview
AD CODE
6 article preview 7 article preview
8article preview 9 article preview
AD CODE

At the moment I know to add the AD CODE at the end of all the previews (Template article_preview).

Any help of what conditional and in which template have I to use?

Thanks!

MGP_Tech 03-25-2012 04:43 PM

What conditional would I use for my postbit to only show the Blog Entries if the user has posted a blog?

MGP_Tech 03-26-2012 07:29 PM

Quote:

Originally Posted by MGP_Tech (Post 2313178)
What conditional would I use for my postbit to only show the Blog Entries if the user has posted a blog?

Found it
Code:

<vb:if condition="$post['entries'] > 0"></vb:if>

egysc 03-27-2012 03:59 AM

I wonder what is the if condition for the mobile phones (any type smart or not ) that can be used ?

sinucello 05-05-2012 08:45 PM

Hi,
thanks for the great posts so far, they helped me a lot with integrating different advertising-codes for different pages (IVW) into the header template. I still need 2 conditions:

1. a conditional for announcements
to render something into the header template in all announcements
2. a conditional that effects all sub-forum of a parent forum or category
as I don`t want to use an array with all the forum IDs because the list of IDs is very long and
might change from time to time

would be great if someone has a solution for those 2.

thank you - all the best,
Sacha

stuartn 05-06-2012 08:36 PM

In user profile options I want to make and option only viewable to be accessed by a certain usergroup. How would you achieve this ?

--------------- Added [DATE]1336340365[/DATE] at [TIME]1336340365[/TIME] ---------------

Quote:

Originally Posted by sinucello (Post 2326562)
Hi,
thanks for the great posts so far, they helped me a lot with integrating different advertising-codes for different pages (IVW) into the header template. I still need 2 conditions:

1. a conditional for announcements
to render something into the header template in all announcements
2. a conditional that effects all sub-forum of a parent forum or category
as I don`t want to use an array with all the forum IDs because the list of IDs is very long and
might change from time to time

would be great if someone has a solution for those 2.

thank you - all the best,
Sacha

This still works for me

https://vborg.vbsupport.ru/showthread.php?t=132716

Then in the html box insert what you need per forum.

nrms? 05-21-2012 02:16 PM

Another conditional in my case I'm using to make improvements in the sharing of urls in topics:

<vb:if condition="$bookmarksites"> show only if showing bookmarks </vb:if>

Yogesh Sarkar 06-02-2012 05:17 PM

If there a conditional that can be used for CMS home page, which would not have an bearing on rest of the CMS pages?


All times are GMT. The time now is 11:19 PM.

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.02023 seconds
  • Memory Usage 1,867KB
  • 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
  • (9)bbcode_code_printable
  • (1)bbcode_html_printable
  • (7)bbcode_php_printable
  • (15)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