vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Dynamic Announcements: Programmable Forum Home Announcement/Message with conditionals (https://vborg.vbsupport.ru/showthread.php?t=43194)

Logician 09-04-2002 10:00 PM

Dynamic Announcements: Programmable Forum Home Announcement/Message with conditionals
 
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 (or other board pages), not inside thread view. So visitors will read them without clicking on them.
  • The Hack's announcements are not static: ie. they can be powerfully programmed to change themselves according to many conditions.
Basic Usage : You can set a text in your Admin CP and it's displayed in forum home to all users.

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. his profile field Z is X
  4. user has X posts or has more than Y posts but less than Z posts
  5. his last visit time was X days ago
  6. 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
  7. User is invisible/visible
  8. user is using style A
  9. his cookies are on
  10. his timeset is set to A
  11. etc..

The conditionals even allows you to design "Board Tips" ever changing according to user's seniority or post number. See how-to document for conditional usage and more info..

It's tested in both v.2.2.6 and v.2.2.7 but it should work with any versions > 2.0.3. (v.2.2.8 or later Users READ HERE!) I'm using it in my own board and a friend's board for more than a month and found it quite stable and released it. Although not likely, if you found any bugs, holler and I'll fix it..

Here is a Screenshot from a "general announcement".
Here is a Screenshot of announcement which is addressed to a certain user.

Some Features:
  • It's Admin CP integrated (Screenshot)
  • Smiley and BBCode in announcements are parsed
  • 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.


If you have problems displaying HTML/smilie/bbcode in your announcements, make this tiny change in hack code

If you install the hack, click INSTALL, thank you..

Logician \\=^))

Logician 09-05-2002 02:50 PM

Screenshot1:

General announcement in forum home

Logician 09-05-2002 02:51 PM

Screenshot2:

An announcement addressed to a specific user only. (Needless to say it will be visible only if the visitor is that user)

Logician 09-05-2002 02:51 PM

Screenshot 3:

Admin CP/Settings: Where you customize your announcements

Logician 09-05-2002 02:52 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. (Delete the previous one). 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.

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.

Notice About vbulletin admin CP/settings bug: While I code this hack I have noticed that vbulletin Admin CP/Settings section has a bug. This hack's installation step 6 also fixes this bug so you wont be effected by it after the installation. You can find more info about this bug in the official vbulletin.com thread.

Hope this document helps you to understand the term conditional. You can use this help page as a reference for this hack, for WebTemplates Hack and for some of other hacks I am coding at the moment. I have recently noticed that vbulletin version 3 will also have a concept "vb conditionals". I dont know their syntax but their logic will be same so you can consider yourself lucky by using the conditionals before it's officially integrated to the script.

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). Thank you.

Logician 09-05-2002 02:52 PM

Add-on 1: Forum Tips Depending on visitor's post count

If you copy/paste this text into your announcement box, you'll create a forum tips announcement which will be displayed to your visitors according to their post count.

Eg.
If his post number < 1 displays "Tip 1"
If his post number = 1 displays "Tip 2"
If his post number > 1 AND <=5 displays "Tip 3"
etc..

More info in the text file..

Logician 09-05-2002 02:53 PM

Add-on 2: Forum Tips Depending on visitor's seniority

If you copy/paste this text into your announcement box, you'll create a forum tips announcement which will be displayed to your visitors according to their seniority (register date)
Eg.
If he registered today displays "Tip 1"
If he register day >1 AND <3 displays "Tip 2"
If he register day >=3 AND <5 displays "Tip 3"
etc..

More info in the text file..

MarkB 09-05-2002 02:56 PM

:o Very interesting hack!! :o

KarateKid 09-05-2002 03:14 PM

You're great Logican, you alway create very helpfull hacks!

Thank you very much! :)

Dean C 09-05-2002 03:14 PM

this is AWESOME... one of the best hacks... im definately going to install this later 2nite :D

- Mist

assassingod 09-05-2002 03:38 PM

Bloody brilliant:) Defintely going to install this one! Great work Logican

Floris 09-05-2002 05:01 PM

Just like Mist says 'this is awesum!'
We are totally gonna try and see if we can use this.

g-force2k2 09-05-2002 05:11 PM

awesome hack Logician :) reason why you're one of the best at vb.org ;) keep up the great work...

g-force2k2

xug 09-05-2002 05:38 PM

One of the coolest hacks I have seen in a while.

Velocd 09-05-2002 06:27 PM

Terrific hack Logician, as it will defiantly will prove useful for many ;)

*slaps install*

hypedave 09-05-2002 06:48 PM

Dude this is jus what I was looking for, I see this as a good way to warnmembers, welcome visitor's even advertisement, or annouce to moderators board meetings, is is to cool, thanks and definetly keep up the good work

joeboo 09-05-2002 09:33 PM

sexy sexy! i will definetly install this

Vile 09-05-2002 11:21 PM

Great hack! :)
Easy installation too, thanks a bunch:)

SemperFidelis 09-06-2002 04:31 AM

Absoluetly brilliant hack
Very impressive
Thankyou very much
:D

NexDog 09-06-2002 11:08 AM

Whoah, wtf? This is %$#*&@$& amazing dude!!!!!!!!!!!

/me can't wait to install

Floris 09-06-2002 04:24 PM

Installed, everything went 100% ok :) I use it on my site

TECK 09-06-2002 04:40 PM

as usual, great hack logician. congrats on your fine work.
floren.

LOD-squa 09-06-2002 07:23 PM

I installed it good hack.

Intex 09-07-2002 07:41 AM

V. Nice hack m8. Will check this out soon.

DrkFusion 09-07-2002 01:23 PM

Nice work Locien, I just got a chance to get on the net after school started, and I see so many new hacks, great job :)

Alien 09-08-2002 05:06 AM

Incredible idea, nice work on this indeed! :D

Logician 09-09-2002 09:20 AM

To all thread repliers:
Thank you all for your kind comments. I hope you find its usage after installation as much easy as you liked the hack. The "conditionals" might be a little bit confusing especially for newbies, I'm aware of that. But it's really them that makes the hack powerful and highly customizable so all I could do was to supply a good how-to document about them.

If you liked this hack you might want a check these hacks which uses the same conditional power:
Advanced Templates: To design dynamic vb templates with conditionals
WebTemplates: To design non-vb pages which compile data from your vb inside Vb Admin CP(and it has conditional support too)

I really love the power of conditionals so wait for some more hacks from me which is centered around this concept.. :)

Bad Bunny 09-10-2002 04:53 AM

Firstly, this sounds very cool and fun to expiriment with making new conditionals.

Question: How many queries does this add?

Logician 09-10-2002 07:18 AM

Quote:

Originally posted by Bad Bunny
Question: How many queries does this add?
Let me give you a "good answer" for your "good question": Surprisingly none. :)

It does not increase your query load because it does not make any SQL connection to your server (as you might have noticed from the hack code). I can hear the question: "Then how does it grab the announcements?" The answer is they are loaded together with your vb settings (that is why I integrated the Admin CP mod. to vb settings screen). And since the settings are already pulled from the db, we dont need to make an extra query for announcements..

Buddha 09-11-2002 09:42 PM

this is fan-damn-tastic logician.
i've already got a few of your hacks installed.
thank you very much.

Willard Reece 09-11-2002 10:16 PM

I just tried to install and got this error.

Warning: Failed opening './global.php' for inclusion (include_path='') in /home/reecefam/public_html/DFHA_install.php on line 3

What did I do wrong.
here is where I am trying to run from

reecefamilies.com/vp/DFHA_install.php

Thanks
Willard

Reecefamilies

Logician 09-12-2002 05:44 AM

Quote:

Originally posted by Willard Reece
[B]I just tried to install and got this error.

Warning: Failed opening './global.php' for inclusion (include_path='') in /home/reecefam/public_html/DFHA_install.php on line 3
You have to upload (and run) the installation file from your FORUM directory (where global.php resides). It seems that you uploaded the file to a wrong directory.

I checked your site and for you correct dir is:
http://www.reecefamilies.com/vp/forums/

Upload and run (once!) the file from there and you'll be fine..

Xenon 09-12-2002 09:11 AM

As i thought, i'm away for two week and Pal Logician writes a terrific hack.

Very good work pal, and not increasing the querie amount
:thumbsup:

i'm sure i'll install it :)

Willard Reece 09-12-2002 08:13 PM

Logician

Thank you so much..

It worked like a dream,

This is the second hack I have done by myself,
first hack was games hack and now this one. So i'm learning

The first addition I added to my board was vbportal.
I had to have alot of help on the...vbportal add on.

MalaK_3araby 09-12-2002 10:15 PM

sounds just Great.

will try it soon.

Thanks logician ..

Willard Reece 09-12-2002 10:41 PM

Just another word


Man this is nice!!!!!!!!!!!!!!!!!!!!!!!


Reecefamilies

Logician 09-13-2002 07:31 PM

Quote:

Originally posted by Willard Reece
Just another word

Man this is nice!!!!!!!!!!!!!!!!!!!!!!!

Seems your visitors liked it too.. :)

A few tips for your board:
a) You can use bbcode in your announcement so you can link the relevant thread inside your announcement with url tag
b) Your poll is open to site members only so you can limit your announcement for only their view too. Just add:
[[($bbuserinfo[userid]>0)]] in the begining and [[/($bbuserinfo[userid]>0)]] in the end of your announcement which will restrict this announcement for only your members' view and guest will not see it..

Enjoy..

Willard Reece 09-16-2002 06:36 PM

I'm trying to uninstall this hack to see if it is my problem.

I got it installed and now 2 days later with out doing anything else to the site, my wifes pc and my neice's pc don't log on. and I ask someome else and they said the same.
It takes there name and p/w and comes back to a blank 404 error page.
Anyone have this problem yet??

Thanks
Wilard
Reecefamilies

Logician 09-16-2002 07:00 PM

Quote:

Originally posted by Willard Reece
I'm trying to uninstall this hack to see if it is my problem.

I got it installed and now 2 days later with out doing anything else to the site, my wifes pc and my neice's pc don't log on. and I ask someome else and they said the same.
It takes there name and p/w and comes back to a blank 404 error page.
Anyone have this problem yet??

Thanks
Wilard
Reecefamilies

It does not sound like your problem is related to this hack. But to make sure try these steps:
1- Delete your announcement box and try again. It can be a invalid conditional you set can be the cause.
2- Delete the part you added to global.php. This is very close to uninstall and if the hack is your problem, it will be solved in this step.

The hack has been used in many boards for sometime now (including mine) and I havent noticed any bugs (especially something weird like that). And the problem you refer does not seem related to a section this hacks changes. But let me know anyway..

BTW.:
1- Does it your wife's PC not logging on or her account. That is, can she log in from another computer?
2- Do other people logon without problems?
3- What's the URL they get after unsuccessful login attemps.

It sounds like it's related to member.php so I suggest checking this file too, especially if you applied any hacks there..

Willard Reece 09-16-2002 07:12 PM

If I go to another pc , I can't even log on as myself.
4 pc's and can't log on,,maybe more havn't heard from anyone yet,
My main pc here is logging on because I have it save in cookies.
I hope thats why.


url comes up this
http://www.reecefamilies.com/member.php
and error 404 page.
After trying to log on.

and can't log on with her name or my neice's account.


All times are GMT. The time now is 01:54 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.01544 seconds
  • Memory Usage 1,846KB
  • 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
  • (4)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