Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles
Useful & unique template conditionals
Dr.CustUmz's Avatar
Dr.CustUmz
Join Date: Aug 2013
Posts: 647

 

USA
Show Printable Version Email this Page Subscription
Dr.CustUmz Dr.CustUmz is offline 04-18-2016, 09:00 PM

For some of the basic conditionals visit THIS THREAD

This list is meant for developers and are conditionals I have collected and made over the years.

If you have a unique / useful conditional to add please share and I will add it to the list.

if browser using google chrome
Chrome returns both safari, and chrome. trying to detect it with only chrome, does not work.
Code:
<if condition="is_browser('safari')&&('chrome')">CHROME</if>

New posts
Code:
<if condition="$show['gotonewpost']">
Code:
<if condition="$forum[statusicon]=='new'">

If hot thread
if reply count is greater than or equal to number of posts to be considered a hot thread option and that option is greater than 0
OR
if view count is greater than or equal to number of views to be considered a hot thread option and that option is greater than 0
Code:
<if condition="($thread['replycount'] >= $vbulletin->options['hotnumberposts'] AND $vbulletin->options['hotnumberposts'] > 0) OR ($thread['views'] >= $vbulletin->options['hotnumberviews'] AND $vbulletin->options['hotnumberviews'] > 0)">

If thread open
Code:
<if condition="$thread['open']">

Show to guest if registration is on
Code:
<if condition="$show['registerbutton']">

No replies
Code:
<if condition="$thread['firstpostid'] == $thread['lastpostid']">
Code:
<if condition="$thread['replycount'] == 0">

if user posts less than 1
Code:
<if condition="$bbuserinfo['posts'] < 1">

if these forum ids
Code:
<if condition="in_array($foruminfo['forumid'], array(1, 2, 3))">
Code:
<if condition="in_array($forum['forumid'], array(1, 2, 3))">

if these scripts (page name)
Code:
<if condition="in_array(THIS_SCRIPT, array('newreply','showthread', 'showpost'))">

if thread has prefix
Code:
<if condition="$thread['prefix_rich']">

if this page of this script
Code:
<if condition="THIS_SCRIPT == 'index' AND $page == 2">

if last post over a year ago
Code:
<if condition="$thread['lastpost'] < (TIMENOW - (365 * 86400))">

If thread starter
Code:
<if condition="$thread['postuserid'] == $post['userid']">

if unread message
Code:
<if condition="$bbuserinfo[pmunread]">

if user option show avatars
Code:
<if condition="$bbuserinfo[showavatars]">

if notification
Code:
<if condition="$notification['total'] > 0">

This one is just as an example (something to build from) but the jist of what it says is:
If can register OR option is on and is an admin
Code:
<if condition="$show['registerbutton'] OR ($vboptions[drc_rb] == 1 AND ($vboptions[drc_rb_edt] == 1 AND is_member_of($bbuserinfo, 6)))">

This is more of a Reference / backup for my snippets, but again feel free to add yours and I will add it to the list.
Reply With Quote
  #2  
Old 05-24-2020, 06:16 AM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

New conditional just had to figure out, thought I'd share, and make a backup of it =)

if browser using google chrome
Chrome returns both safari, and chrome. trying to detect it with only chrome, does not work.
Code:
<if condition="is_browser('safari')&&('chrome')">CHROME</if>
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:07 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.03493 seconds
  • Memory Usage 2,207KB
  • Queries Executed 15 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (21)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (5)post_thanks_box_bit
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (2)post_thanks_postbit_info
  • (1)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete