Activity Stream
48,167 MEMBERS
62777 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 5 of 5
  1.     
    #1
    Member
    Website's:
    Doxsters.net

    Default Using Vbulletin Conditionals

    Hi Guys,
    Thought i'd write a tutorial on using vBulletin conditionals, i got some spare time

    What is a conditional?
    Basically, its an <if> tag that checks if something is true or not.
    Whatever the conditional is wrapper around is only executed/seen if the condition is met, hence the name conditional

    Some Common Conditionals:
    First of all Note that these conditionals havent been found by me, etc. I just googled for em
    Anyway hers a few that i find useful

    Code: 
    <if condition="is_member_of($vbulletin->userinfo, X, Y, Z)"></if>
    Anything wrapped in this conditional would only display to members of usergroups X,Y or Z. OBviously u can add more to the array.

    Code: 
    <if condition="THIS_SCRIPT == 'index'">
    Lets say you've got your ad on your header but you only want to display it on your index page. This is what this conditional does. To find out the name of the page, you have to look at the php file itself and look for
    Code: 
    define('THIS_SCRIPT', 'index');
    Code: 
    <if condition="$bbuserinfo['userid'] == 667">
    This would only show the content to one user, in this case user 667

    Code: 
    <if condition="in_array($forumid, array(X,Y,Z))">
    What this does, is display the content in only a certain forum, with X,Y,Z being replace with the forum id

    Code: 
    <if condition="$bbuserinfo['birthday_search'] > '1980-01-01'">
    What this does is check the birthday of the user. Obviously replace 1980-01-01 with the birthday you want. Very Useful in adult sections.

    Code: 
    <if condition="can_moderate($forum['X'])">
    This checks if the user is a moderator of the current forum. Replace X with the forumid

    Code: 
    <if condition="$threadinfo['postuserid'] == $bbuserinfo['userid']">
    This checks if the user is the thread starter or not. Still havent found ause for this one

    Code: 
    <if condition="!$GLOBALS['FIRSTPOSTID']">
    This is used to place something directly under the first post. Especially useful for ads, etc

    Else and Not

    Okay now for something a little more complex. With all these conditionals you can use an <else> tag to execute different information if the condition isn't met.

    So for example:
    Code: 
    <if condition="$bbuserinfo['birthday_search'] > '1980-01-01'">
    <!---Adult section stuff here-->
    <else>
    Too Young
    </if>
    This would Display Too Younf if the user didnt meet the required age

    There is also the ! character. If you put that infront of the =, the conditional will check if the condition is not met.
    So for example
    Code: 
    <if condition="$bbuserinfo['userid'] != 667">
    Would display information to everyone BUT userid 667.

    Some Common Screwups
    I know i definately did this one a lot
    Basically, Template Conditionals will only work in templates. Full Stop
    I tried using em in bbcodes, was wondering why they didnt work
    But yeah, now you know.



    Finally got this finished, enjoy
    -timtamboy63

    Oh and let me know if u need any help
    timtamboy63 Reviewed by timtamboy63 on . Using Vbulletin Conditionals Hi Guys, Thought i'd write a tutorial on using vBulletin conditionals, i got some spare time :) What is a conditional? Basically, its an <if> tag that checks if something is true or not. Whatever the conditional is wrapper around is only executed/seen if the condition is met, hence the name conditional Some Common Conditionals: First of all Note that these conditionals havent been found by me, etc. I just googled for em :P Anyway hers a few that i find useful Rating: 5

    Need a Designer/Web Developer? Click Me

    MSN: PM me for it.
    Email(Preferred):timtamboy63@gmail.com

    "Power Corrupts. Absolute Power Corrupts Absolutely"

  2.   Sponsored Links

  3.     
    #2
    Banned
    Website's:
    FusionWarez.info SmokeHost.net Leechers.co
    Nice Tutorial, I already knew most of this, but some I didn't so thanks

  4.     
    #3
    Member
    Website's:
    maxedoutdesigns.com
    Nice tutorial will help me out it the future
    What do i do?
    vBulletin Skins,Custom CMS Designs,Wordpress Designs
    and much more!
    Thread :: Website

  5.     
    #4
    Super Member
    conditionals are amazing, learnt how to manipulate those a few weeks ago

    So kiss me and smile for me, say that you'll wait for me <'3

  6.     
    #5
    Member
    Website's:
    Doxsters.net
    Yeah, there great,
    If anyone wants more just google search "Vbulletin Conditionals"

    Need a Designer/Web Developer? Click Me

    MSN: PM me for it.
    Email(Preferred):timtamboy63@gmail.com

    "Power Corrupts. Absolute Power Corrupts Absolutely"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [vBulletin] Understanding vBulletin Database Errors!6019+8.6
    By Exel in forum Tutorials and Guides
    Replies: 0
    Last Post: 10th Apr 2012, 12:11 AM
  2. Replies: 6
    Last Post: 27th Sep 2011, 05:57 PM
  3. vBulletin Template Conditionals List
    By jokerhacker in forum vBulletin
    Replies: 0
    Last Post: 30th Jul 2011, 10:54 PM
  4. Template Conditionals For VB4
    By AmN in forum vBulletin
    Replies: 1
    Last Post: 16th Oct 2010, 02:03 PM
  5. FS Owned vBulletin License with vBulletin Blog
    By JMaldo in forum Completed Transactions
    Replies: 5
    Last Post: 19th Aug 2009, 10:58 PM

Tags for this Thread

BE SOCIAL