vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Dynamic Announcements: Programmable Forum Home Announcement/Message with conditionals (https://vborg.vbsupport.ru/showthread.php?t=97073)

Logician 09-27-2005 10:00 PM

Dynamic Announcements: Programmable Forum Home Announcement/Message with conditionals
 
(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 keeps asking in the 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 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:
  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.
Here is a Screenshot from a general table announcement.
Here is a Screenshot from a popup announcement.

Some Features:
  • Coded as a vbulletin pluggin. Can be installed easily without hacking PHP files.
  • It's Admin CP 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
* 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 \\=^))

Logician 09-28-2005 05:10 PM

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[posts]==1)]] Show this announcement if page visitor has just 1 posts [[/($bbuserinfo[posts]==1)]]

* [[($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.

Logician 09-28-2005 05:10 PM

[reserved for future use like FAQ]....

TyleR 09-28-2005 05:14 PM

heyyy, nice to see this ported to 3.5 :)

[high]* TyleR clicks install[/high]

Feckie (Roger) 09-28-2005 05:16 PM

Nice One Thanks

David_R 09-28-2005 05:20 PM

Quote:

Originally Posted by Feckie (Roger)
Nice One Thanks

hey Logician, thanks for updating the hack. just one question, does the 3.5 version carries any improvements over 3.x version ?

thanks.

Logician 09-28-2005 05:27 PM

Quote:

Originally Posted by David_R
hey Logician, thanks for updating the hack. just one question, does the 3.5 version carries any improvements over 3.x version ?

It is mostly same but there a few improvements:

1- You can set up the frequency of popup announcement. Eg. you can make it popup in every 12 hours for the same user instead of every visit. (See admin cp screenshot above)

2- I get rid of the complainted "green" color Popup window and make it inherit your vb style with a cool red border.

3- It does not require any PHP hacking and can be installed through your admin cp as a pluggin.

4- Unlike vb3.x version, I don't support "header" version of it in which the announcement is displayed in all forum pages, not only forum home. It caused some minor bugs in post cached enabled forums so I only support forumhome announcement version which is stable

TTG 09-28-2005 07:25 PM

Great hack and could be very useful, I do however have one problem :)

I have a flash header on my forum and the popup announcements are hidden behind the flash .. is there any way of placing the popup announcements to show lower within the forum ?

Logician 09-28-2005 08:09 PM

Quote:

Originally Posted by TTG
Great hack and could be very useful, I do however have one problem :)

I have a flash header on my forum and the popup announcements are hidden behind the flash .. is there any way of placing the popup announcements to show lower within the forum ?

Sure.. You can edit template 'dfh_announcement_popup'. The location of popup announcement is fixed there in the line:

PHP Code:

<DIV ID="ANNLAYER" STYLE="background-color: red; position: absolute; margin-left:5; margin-right:5; margin-top:5; margin-bottom:0; top: 50px; bottom: 50px; left: 50px; right: 50px; padding: 10px; overflow: auto; border-color: 000000; border-style: solid; border-top-width: 2px; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 2px;"


Sovereign 09-28-2005 08:54 PM

Yay awesome! Been wanting this.

TTG 09-28-2005 09:13 PM

Quote:

Originally Posted by Logician
Sure.. You can edit template 'dfh_announcement_popup'.

Thanks Logician .. clicked install.

SHANE-D-PAIN 09-28-2005 09:42 PM

Looks great, I will be sure to install this tomorrow after College or maybe even in College depending on the mood of the lesson!

Could be useful for letting members know about parts of the site that are not used all to often! :D

Gottcha 09-28-2005 09:48 PM

downloaded and installed ... can get the popup to work fine but cant get the Forum Home Table Announcement to work...any ideas?

memorex 09-28-2005 10:26 PM

Looks sweet, I'll install as soon as I have 3.5.0 gold upped :D

dieselpowered 09-29-2005 05:45 AM

Please forgive my ignorance, however, I did a quick little test for the pop-up, just a one line announcement and the red window is the size of my screen???

How do I make it look like yours with just a small red outline around the window?

Great hack!

Logician 09-29-2005 07:08 AM

Quote:

Originally Posted by Gottcha
downloaded and installed ... can get the popup to work fine but cant get the Forum Home Table Announcement to work...any ideas?

I'd say make sure you applied INSTALLATION STEP 2 correctly. (If you have more than 1 style sets, repeat this step for all FORUMHOME templates in all style sets)

Logician 09-29-2005 07:09 AM

Quote:

Originally Posted by xtremeoff-road
Please forgive my ignorance, however, I did a quick little test for the pop-up, just a one line announcement and the red window is the size of my screen???

How do I make it look like yours with just a small red outline around the window?

Great hack!

Please see POST #9 in the thread. You can play with everything about popup announcements design via that line.

Logician 09-29-2005 08:46 AM

Just a confirmation since vb 3.5.0 GOLD is released : The hack works fine with vb 3.5.0 GOLD.

dieselpowered 09-29-2005 01:38 PM

Quote:

Originally Posted by Logician
Please see POST #9 in the thread. You can play with everything about popup announcements design via that line.

I am sorry, I guess I missed that.

At first glance it looks as though it has something to do with the flash.

Thanks.

Vizionz 09-29-2005 03:13 PM

awesome hack thanks

dreck 09-29-2005 04:23 PM

Nice hack, installed on 3.5.0 gold no problems. :banana:

Thanks.

*install*

utw-Mephisto 09-29-2005 05:11 PM

Just wondering, I don't see in the screenshots to turn it actually off ? Do I have to remove the text to disable it ?

Just wondering about events I would like to announce in a popup which I use several time .. I just want to avoid typing it everytime (or copy / paste etc.) ...

Vizionz 09-29-2005 05:24 PM

if you dont want nothing to show up yeah just remove the text in the fields and nothing will show up or just disable the plugin till u need it then reable it

utw-Mephisto 09-29-2005 05:42 PM

I was afraid you'd say that ;)

Logician 09-29-2005 06:53 PM

Quote:

Originally Posted by utw-Mephisto
Just wondering, I don't see in the screenshots to turn it actually off ? Do I have to remove the text to disable it ?

Just wondering about events I would like to announce in a popup which I use several time .. I just want to avoid typing it everytime (or copy / paste etc.) ...

If you don't want to remove and readd the text, put it inside a wrong conditional :

[[(1==0)]]
My text that I don't want to reinsert everytime
[[/(1==0)]]

So when you want to enable it you can remove conditional tags and it is on.

SirJonathan 09-29-2005 07:46 PM

Just wanted to say.. AWESOME!.. Thanks! :) Love this hack!

utw-Mephisto 09-29-2005 07:52 PM

Quote:

Originally Posted by SirJonathan
Just wanted to say.. AWESOME!.. Thanks! :) Love this hack!

I must 2nd that :) Works like a charm ..

SirJonathan 09-29-2005 08:29 PM

Hey there!

As I'm re-installing the mod I've been studying the conditionals and I came up with a conditional which I couldn't seem to make work. Is there anyway I could have a message show if a user hasn't posted in a certain forum? So, if user has no posts in (insert forum ID), a message will display?

Would this be possible? :)

Thanks!

-Jonathan

bang 09-29-2005 08:42 PM

I have the vBShout hack installed, and the accouncement box appears under the shoutbox. is there a way to move it directly under the navbar, above the shoutbox?

Vizionz 09-29-2005 08:44 PM

you have to edit the template for the pop up in your style

dfh_announcement_popup

Code:

<DIV ID="ANNLAYER" STYLE="background-color: black; position: absolute; margin-left:255; margin-right:255; margin-top:354; margin-bottom:50; top: 341px; bottom: 120px; left: 130px; right: 5px; padding: 1px; overflow: auto; border-color: 000000; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px;">

Andreas 09-29-2005 08:48 PM

Suggest to get rid of the Template edit:

forumhome_complete
PHP Code:

$headinclude .= $dfh_announcement_headercode;
$header $header $dfh_announcement_popup;
$navbar .= $dfh_announcement


XtremeOffroad 09-29-2005 10:29 PM

Very cool, Works flawless so far.
Clicks Install

utw-Mephisto 09-30-2005 08:49 AM

Could someone give me a bit of a code to get a red box around the dynamic announcement (not the popup, the other one) ?

Logician 09-30-2005 08:58 AM

Quote:

Originally Posted by KirbyDE
Suggest to get rid of the Template edit:

forumhome_complete
PHP Code:

$headinclude .= $dfh_announcement_headercode;
$header $header $dfh_announcement_popup;
$navbar .= $dfh_announcement


Edit : Nope, didn't work! Navbar is compiled after "forumhome_complete" hook in index.php ;)

Logician 09-30-2005 08:59 AM

Quote:

Originally Posted by SirJonathan
Hey there!

As I'm re-installing the mod I've been studying the conditionals and I came up with a conditional which I couldn't seem to make work. Is there anyway I could have a message show if a user hasn't posted in a certain forum? So, if user has no posts in (insert forum ID), a message will display?

Would this be possible? :)

Thanks!

-Jonathan

Nope sorry.. The hack can not know whether a user has posted in a forum or not without querying the DB so this can't be done without modifying hack code.

Avalon111 09-30-2005 09:14 AM

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?

Logician 09-30-2005 09:25 AM

Quote:

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

Avalon111 09-30-2005 12:05 PM

thank you very much!!!
everything is working now!

jesus likes pie 09-30-2005 01:23 PM

I am so getting this when I get home!

dookie 09-30-2005 05:42 PM

Nice hack, works fine @ 3.5 Gold


All times are GMT. The time now is 02:03 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02016 seconds
  • Memory Usage 1,881KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (5)bbcode_php_printable
  • (12)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete