How To Use - Conditionals Help
After you installed the hack:
Basic Usage:
If you want to display an announcement to ALL users, simply login to Admin CP/Choose VB Settings/Dynamic Forum Announcements and enter your announcement as a plain text into the box. You can use smilies and all other bbcode in your announcements. This text will be dragged to your forum home regardless of whoever the page visitor is. You can use the poup box if you want to display the annnoucement as popup and the other box if in a table in forum home.
Advanced Usage:
You can use "conditionals" to set announcements displayed if a certain condition applies. If you are using my
WebTemplates Hack , you should be already familiar with the term "conditional". In Webtemplates conditionals could be used to put different texts/HTML codes which will be parsed if certain condition appied in your non-vb pages. It's the same concept and their usage is same. Here is its format:
[[(your conditional)]] Your Announcement [[/(your conditional)]]
Conditional Rules:- Conditionals are covered inside [[ ]] tags
- Conditional itself is in paranthesis ( )
- Announcements are written in between the conditional tags
- Opening and closing conditional are exactly same except closing conditional has a / right before (
- If you are trying to check if a X equals to Y use DOUBLE equation mark not single. eg. Correct: X==Y Incorrect:X=Y
- You can design as many conditional as you like. If more than 1 condition applies at the same time, the conditional which is above (=higher priority) is parsed.
- If you write a plain text without a conditional together with other conditionals, this text is considered "default announcement" and displayed if no conditions applies.
Some examples will help you understand the rules better. Here are some conditionals and the announcement texts which explains what that conditional do:
* [[($bbuserinfo[userid]==32)]] Show this announcement if page visitor's user id is 32 [[/($bbuserinfo[userid]==32)]]
* [[($bbuserinfo[usergroupid]==5)]] Show this announcement if page visitor's usergroupid is 5 (=if he is a Super Mod) [[/($bbuserinfo[usergroupid]==5)]]
* [[($bbuserinfo[usergroupid]==1)]] Show this announcement if page visitor is a guest [[/($bbuserinfo[usergroupid]==1)]]
* [[($bbuserinfo[userid]>1)]] Show this announcement if page visitor is NOT a guest [[/($bbuserinfo[userid]>1)]]
* [[($bbuserinfo[usergroupid]==5 OR $bbuserinfo[usergroupid]==6 OR $bbuserinfo[usergroupid]==7)]] Show this announcement if page visitor's a Super Mod OR a Mod OR an Admin [[/($bbuserinfo[usergroupid]==5 OR $bbuserinfo[usergroupid]==6 OR $bbuserinfo[usergroupid]==7)]]
* [[($bbuserinfo[posts]<10)]] Show this announcement if page visitor has less than 10 posts [[/($bbuserinfo[posts]<10)]]
* [[($bbuserinfo[lastvisit] and $bbuserinfo[lastvisit]<strtotime(-30 days))]]Show this announcement if page visitor has not visited your board for 30 days[[/($bbuserinfo[lastvisit] and $bbuserinfo[lastvisit]<strtotime(-30 days))]]
* [[($bbuserinfo[joindate]>strtotime("-2 weeks") AND $bbuserinfo[joindate]<strtotime("-4 weeks"))]]Show this announcement if page visitor registered in a date between 2 weeks to 4 weeks from now[[/($bbuserinfo[joindate]>strtotime("-2 weeks") AND $bbuserinfo[joindate]<strtotime("-4 weeks"))]]
You can use conditionals together too. Here is an example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[[($bbuserinfo[userid]==32)]] Announcement 1 [[/($bbuserinfo[userid]==32)]]
[[($bbuserinfo[usergroupid]==3)]] Announcement 2 [[/($bbuserinfo[usergroupid]==3)]]
Announcement 3
-=-=-=-=-=-=-=-=-=-=-=-=-=-=
If you set this text as your announcement, the hack will:
Show Announcement 1, if user's userid = 32
Show Announcement 2, if user's usergroupid = 3 (=email confirmation waiting members)
show Announcement 3, For ALL other users
What if user 32 is also from user groupid 3? He will be displayed Announcement 1 because even if he matches both conditional 1 and conditional 2, conditional 1 (which is above) has a higher priority.
Hope this document helps you to understand the term conditional. Needless to say my hack's conditional syntax is different than vb3's default conditional syntax and this is because I use my syntax for a long time (before vb3 was up).
If you need more help to design a "conditional", before asking me please read this document carefully for a few times, try to form it by yourself and if they all fail, ask in the hack's thread giving details about exactly what conditional you tried to form and what text (format) have you tried (and failed). You are welcomed to ask them in thread but my apologies in advance if I'm too busy to answer all questions. Thank you.