The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Dynamic Announcements: Programmable Forum Home Announcement/Message with conditionals Details »» | |||||||||||||||||||||||||||
Dynamic Announcements: Programmable Forum Home Announcement/Message with conditionals
Developer Last Online: Nov 2023
(This hacks works with both 3.5.x and 3.6.x)
This hack allows you to post powerful dynamic announcements (changing according to different conditions) on forum home page. It differs from vbulletin's default announcements in 2 ways:
This version of the hack is for vbulletin 3.5.x and 3.6.x (vb 3.0.x version is here and vb 2.x version is here. 3.5 version is coded as a plugin so you can install it WITHOUT modifying vb PHP files. It is easily installed in 2 steps through your admin cp. Basic Usage of This Hack: You can set a text in your Admin CP and it's displayed in forum home to all users. Alternatively if you want, you can set another text as a popup announcement and it is displayed to all as a pop up announcement (it can't be killed with popup killers software!) Advanced Usage : With conditionals you can set different texts/notifications/messages/announcements and they will be displayed if your pre-configured condition applies. This allows you to create powerful announcements/private messages/texts which address their receipt only if a certain condition is met. Some examples: You can set to show an announcement in forum home IF:
Here is a Screenshot from a popup announcement. Some Features:
* For CMPS Integration see here * French Translation by Allan : https://vborg.vbsupport.ru/showpost....&postcount=143 * Nested Conditionals by dc3dreamer : https://vborg.vbsupport.ru/showpost....&postcount=175 * Hack Annoucement appears in all vb pages: https://vborg.vbsupport.ru/showthrea...498#post911498 IMPORTANT FOR 3.x USERS: If you were already using this hack in 3.0.x, remember to do 2 things: BEFORE YOU INSTALL THIS HACK : Follow this instructions to remove the remnants of 3.0.x hack. AFTER YOU INSTALL THIS HACK : Go to your admin cp / styles, find these 3 styles: dfh_announcement dfh_announcement_headercode dfh_announcement_popup and REVERT THEM so that your new templates that comes with 3.5 version will apply. About vb4.x version: I didn't consider porting this hack to vb4 because vbulletin has now a VERY SIMILAR feature in vb4 called "NOTICES". You can find it under your admin cp/Notices submenu/Notice Manager. It is not as powerful as this hack as this hack allows you to use any kind of conditional to produce your announcement but it is more user friendly because you don't need to deal with conditional syntax, you simply build your announcement (notice) with menus If you install the hack, click INSTALL, thank you.. Logician \\=^)) Show Your Support
|
Comments |
#172
|
|||
|
|||
[[($bbuserinfo[birthday] and $bbuserinfo[birthday] == strtotime("0 days"))]]
Show this announcement if today is page visitor's birthday [[/($bbuserinfo[birthday] and $bbuserinfo[birthday] == strtotime("0 days")]] Is it Correct? :disappointed: |
#173
|
|||
|
|||
Awesome! I have this working under VB 3.5.1.
I did alter it, however. I didn't like the announcement in its own box/table, so instead I edited my style FORUMHOME templates to put the announcement text into the "guest" announcement area, and removed the <if condition="$show['guest']">...</if> so that area always shows. I did not add the $dfh_announcement after $navbar. Instead, I replaced the first_visit_message phrase code with $dfh_announcement_announcementtopaste. Voila! I then used conditionals in the DFHA to control whether my guest message or my registered user message is displayed there. Fine point: I did actually add a new phrase welcome_to_the_x_dfha and switch between that and welcome_to_the_x depending on whether $show['guest'] is true or false. That way the title of the announcement area changes between guests and registered users. I didn't post the code here because it's different in VB Classic vs Surge, etc. I can post the Classic code if needed. Now the display is consistent with the current style, takes up less room, and is really configurable. All you do is edit the DFHA announcement text in the condiitional blox. |
#174
|
|||
|
|||
One thing that got me: You cannot nest conditionals. I might look at your system to see if it can recursively call itself to parse nested conditionals. For me at least, it would be very helpful. I use conditionals to switch between guest and registered user messages, and I can't use any condiitionals inside those. Instead I have to make a rather messy set of linear conditionals for all of the permutations of conditions I have.
Also the conditional syntax is a bit klunky, but I understand it's code you've had for a long ime. If it ain't broke, don't fix it! |
#175
|
||||
|
||||
Quote:
|
#176
|
|||
|
|||
Update #2 (final!): All is well now. Here is the code for dynamic_a() which implements nested conditionals:
Code:
function dynamic_a($logician_dfa_incoming1) { extract ($GLOBALS); // Prevent successive conditionals on separate lines from generating // spurious <br /> after running thru BbCode parser. You might not // like this, it's optional. $logician_dfa_incoming1 = ereg_replace("\]\][\r\n\f \t]*\[\[", "]][[", $logician_dfa_incoming1); // Recursively process nested conditionals $logician_dfa_incoming1 = trim(dynamic_b($logician_dfa_incoming1)); // Finish up by running result through BbCode parser if (trim($logician_dfa_incoming1)) { $parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list()); $logician_dfa_incoming1 = $parser->do_parse($logician_dfa_incoming1, 1, 1, 1, 1, 1, 1); } return $logician_dfa_incoming1; } function dynamic_b($dc3dreamer_dfa_incoming1) { extract ($GLOBALS); while (preg_match("/\[\[(.*)\]\](.*)\[\[(\/\\1)\]\]/siU", $dc3dreamer_dfa_incoming1, $matches14)) { @eval ('if ('.stripslashes($matches14[1]).') { $eval_deger= "1"; } else { $eval_deger= "0"; }'); if ($eval_deger == 1) //if conditional applied, replace with inner text { $dc3dreamer_dfa_incoming1 = dynamic_b(str_replace($matches14[0], $matches14[2], $dc3dreamer_dfa_incoming1)); } else // Conditional not applied, delete the whole chunk { $dc3dreamer_dfa_incoming1 = dynamic_b(str_replace($matches14[0], '', $dc3dreamer_dfa_incoming1)); } } return $dc3dreamer_dfa_incoming1; } I'm slowly coming up to speed on PHP :nervous: I was killed by the $bbuserinfo[membergroupids] variable testing against values, till my ancient Perl tablets fell out on the ground. Yumba! It can be an array and it may not even exist! Well, rookie me! I got it now. This is so nice! Nested conditionals open up a whole new world of possibilities, but ... Thank you Logician Thank you Logician Thank you Logician ... |
#177
|
||||
|
||||
Quote:
|
#178
|
|||
|
|||
Quote:
|
#179
|
||||
|
||||
Quote:
|
#180
|
||||
|
||||
Great hack! Thanks so much Logician
|
#181
|
|||
|
|||
Thanks Logician et merci allan pour ta traduction fr
|
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|