Back to vBulletin 3.5 Add-ons

Dynamic Announcements: Programmable Forum Home Announcement/Message with conditionals
Mod Version: 1.01, by Logician

This modification is in the archives.
vB Version: 3.5.5 Rating: (30 votes - 4.63 average) Installs: 721
Released: 28 Sep 2005 Last Update: 11 Jan 2007 Downloads: 1424
Not Supported Uses Plugins Template Edits  

(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:
  • The announcement is displayed in forum home page, not inside thread view. So visitors will read them on home page without clicking any links.
  • The Hack's announcements are not static: ie. they can be powerfully programmed to display different texts according to different conditions.
For instance you can tell "why they should register" if visitor is a guest, but if he is a member with 0 posts, you can tell him why he should start posting etc.! All in one announcement! Everybody will see the relevant text according to his status. (This is the hack everybody http://www.theadminzone.com/forums/showthread.php?p=94313#post94313 in the http://www.theadminzone.com whose using the hack for members with 0 and 1 posts.)


This version of the hack is for vbulletin 3.5.x and 3.6.x (vb 3.0.x version is http://www.vbulletin.org/forum/showthread.php?s=&threadid=64189 and vb 2.x version is http://www.vbulletin.org/forum/showthread.php?s=&threadid=43194. 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:
  1. user is X
  2. user's usergroup is Y
  3. user has X posts or has more than Y posts but less than Z posts
  4. his last visit time was X days ago
  5. today is X, hour is between Y and Z, day is wednesday, month is Y, week is month's 2nd week, today is user's birthday
  6. etc.
from a general table announcement.
from a popup announcement.

Some Features:
  • Coded as a vbulletin pluggin. Can be installed easily without hacking PHP files.
  • It's integrated
  • Smiley, BBCode, HTML, IMG tags are supported in announcements.
  • You can address your users with their usernames inside announcements (Use $bbuserinfo[username] variable)
  • Announcements are displayed directly in Forum Home so users are forced to read them.
  • The Conditionals help you to design powerful and ever changing announcements/private messages/forum home notifications.
  • Poupup announcement can not be killed by popup killer software
Hacks of Hack:
* For CMPS Integration see here

Spoiler (click to open)


For all you VBA CMPS users I have this working on the CMPS home Page. Here is what I did. I am no coder but it works on my site. I also add step 2 to forum display and showthread.

1. in the Plugin System -> Plugin Manager
move Dynamic Forum Home Announcement Hack by Logician from forumhome_complete to Global_start hook location

2. edit adv_portal template just the same as in the forumhome template.
Replace
Code:
</head>
<body>
$header
$navbar
with
Code:
$dfh_announcement_headercode
</head>
<body>
$dfh_announcement_popup
$header
$navbar
$dfh_announcement
3. ADmincp -> VBA CMPS -> Default Settings -> Portal Output Global Variables

Add the following
dfh_announcement
dfh_announcement_popup
dfh_announcement_headercode

and Save

Close

* French Translation by Allan :

Spoiler (click to open)


The French Language
Attached Files
File Type: xml product-lh_dynamic_fhannouncement_french.xml (6.7 KB, 26 views)

Close

* Nested Conditionals by dc3dreamer :

Spoiler (click to open)


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;
}
The recursion continues until there are no conditionals found, at which point the final result is passed through the BbCodeParser at the end of the first method. The trick was to remove line endings from conditionals that follow one another with just newlines between. They generated extra breaks and line spacing after going through the BbCode parser. You might want to remove the * in the regexp for the call to ereg_replace(). Er, do I really have to name my parameter variable like it might exist in the host page? I hope not, but I copied Logician's style. I would have used sumpin' like $src for the parameter var :nervous:

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 ...

Close

* Hack Annoucement appears in all vb pages:

Spoiler (click to open)


Hack of hack to make it appear in all vb pages.

IMPORTANT NOTE:This hack is originally designed to display the hack announcement in FORUMHOME PAGE ONLY! And I'm only supporting the hack when it is used in the way it is designed. However many users asked how they can make the hack announcement appear in other vb pages too so I'm sharing how to do this. BUT : this is not tested good enough by me, nor do I have time to test it so if you are changing how the original hack works by applying the instructions below, you are on your on if a problem comes up. I dont support the hack anymore when the instructions below are applied. If it does not work as expected, use the original hack.

Close




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

Spoiler (click to open)


Quote by Avalon111
i have used your old version of this hack with 3.0.9. worked great!

today i have uplraded my forum to 3.5 gold.
i have deleted the old dfh templates and installed this new version on my forum.

now i have 2 forum home and 2 pop up boxes in admin cp. only 1 of each is working.

what have i done wrong?
Nothing.. Please follow these step:
* admin cp/manage products/uninstall Dynamic Forum Home Announcement Hack by Logician
* edit includes/config.php, find:

PHP Code:
?> 
replace this line as:
PHP Code:
// Debug
 
$config['Misc']['debug'] = true
?> 
(and upload to the server)

* login to admin cp, go to vb options/dynamic forum home announcements

* delete all settings and settings group in that page to remove 3.0 settings. (by clicking "delete" next to 2 settings and 1 setting group title)

* Revert your config.php (and upload the server)

* Now install 3.5 version.

Close
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, , thank you..

Logician \\=^))

Download

This modification is archived and cannot be downloaded.

Screenshots

     

Similar Mods

Dynamic Announcements: Programmable Forum Home Announcement/Message with conditionals vBulletin 3.0 Full Releases
Dynamic Announcements: Programmable Forum Home Announcement/Message with conditionals vBulletin 2.x Full Releases
Dynamic Forum Home Announcement - vBaCMPS Integration vBulletin 3.0 Full Releases

vblts.ru supports vBulletin®, 2022-2024