vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Global Announcement Popup v1.5 (https://vborg.vbsupport.ru/showthread.php?t=70976)

Revan 10-24-2004 09:00 PM

Global Announcement Popup v1.5
 
As requested by Overlord, here it is. The "Popup At New Global Announcement"!

This hack's function is quite simple. Whenever you add a Global Announcement (IE one that will display in All Forums), all users will see a popup notifying them of this.
(See screenshot)


I won't make it recurring (IE if user clicks Cancel, they get to see the popup again), because it will piss users off.
And I won't have it displaying for Local Announcements (IE announcements that are only displayed in 1 forum) because this would clutter an user's screen if it is an active forum where lots of announcements are made.


Tested and working on 3.0.3, but should work on 3.x.x fine.
Enjoy! :)

Dan 10-25-2004 03:59 PM

Quote:

Originally Posted by Revan
As requested by Overlord, here it is. The "Popup At New Global Announcement"!

This hack's function is quite simple. Whenever you add a Global Announcement (IE one that will display in All Forums), all users will see a popup notifying them of this.
(See screenshot)


I won't make it recurring (IE if user clicks Cancel, they get to see the popup again), because it will piss users off.
And I won't have it displaying for Local Announcements (IE announcements that are only displayed in 1 forum) because this would clutter an user's screen if it is an active forum where lots of announcements are made.


Tested and working on 3.0.3, but should work on 3.x.x fine.
Enjoy! :)

Nice hack looks kinda useful :) Thanks for sharing!

Polo 10-25-2004 04:36 PM

This may come in handy, thanks for sharing revan :)

Blam Forumz 10-25-2004 05:35 PM

Installed :D

SnowBot 10-25-2004 10:40 PM

I like the idea of this, i may modify it to my needs but GREAT work.

Overlord 10-26-2004 01:08 AM

Works like a charm, thanks mate good stuff :D *clicks Install*

Bryan Ex 10-26-2004 03:42 AM

This is perfect! Up to now I've had to edit my navbar template and hard code stuff to ensure it was seen. Thanks for sharing this one.

Overlord 10-27-2004 06:14 AM

Ok, some of my members are receiving a no permision page when they click 'ok' on the announcement. even tho the announcements are global. even super mods are getting the permission denied page.

Any idea what'sc ausing this?

Revan 10-27-2004 06:35 AM

Crap... I know whats causing this...
When I wrote the code to decide what forum the announcement should be in (because you cant just view an announcement, it has to be in a forumid), I queried the forums dbase and ordered by RAND(), so it takes a random forum id.
So if a forum smods cant enter is chosen, the announcement is pwned.

Ill try to fix this when I get home.

Overlord 10-27-2004 10:09 AM

Yeah I see :P I checked the php and saw where you did this, although I don't know php very well, just changing it to link to any specific forum anyone can view would work would it not? if you can alter the code to allow users to just replace whatever is there with their 'news' forums id number or whatever that would be handy.

Revan 10-27-2004 02:06 PM

Bug fixed, and released as v1.5

To upgrade, simply redo a global.php edit.
Here's the new code:
PHP Code:

// #############################################################################
// get new announcement popup
$newannounce 0;
$shownewannounce false;
if (
$bbuserinfo['userid'] AND $bbuserinfo['announcepopup'] == 2)
{
    
$DB_site->shutdown_query("UPDATE " TABLE_PREFIX "user SET announcepopup = 1 WHERE userid = $bbuserinfo[userid]"'announcepopup');
    if (
THIS_SCRIPT != 'announcement')
    {
        
$newannounce 1;
        
$newann $DB_site->query_first("
            SELECT * FROM " 
TABLE_PREFIX "announcement AS announcement
            WHERE forumid = '-1'
            ORDER BY startdate DESC
            LIMIT 1
        "
);
        
$annforum iif($newann['forumid'] == -1truefalse);
        if (
$annforum == true)
        {
            
$forumpermarray $bbuserinfo['forumpermissions'];
            
ksort($forumpermarray);
            
reset($forumpermarray);
            foreach (
$forumpermarray as $key => $value)
            {
                
$forumperm["$key"] = convert_bits_to_array($forumpermarray["$key"], $_BITFIELD['usergroup']['forumpermissions']);
                if (
$forumperm["$key"]['canview'] == 1)
                {
                    
$forumids .= ", $key";
                }
            }
            
$forumids substr_replace($forumids''02); 
            
$forumann $DB_site->query_first("
                SELECT 
                    forumid 
                FROM 
                    " 
TABLE_PREFIX "forum
                WHERE forumid IN (
$forumids)
                ORDER BY RAND()"
);
            
$theforum $forumann['forumid'];
        }
        else
        {
            
$theforum $newann['forumid'];
        }
        
$newann['title'] = addslashes(unhtmlspecialchars($newann['title'], true));
        
$shownewannounce true;
    }



docvader 11-25-2004 04:39 AM

Nice hack, and easily installed, except for one thing, and it's mainly because of my ignorance. But I'm not to thrilled playing with databases (I'm a buffoon when it comes to databases), so this part of the install, "ALTER TABLE `user` ADD `announcepopup` tinyint(1) NOT NULL DEFAULT '0' ", kind of throws me. I'm fearful of messing around in this without knowing what I'm doing.

Can anyone post a simple way of doing this? I use PHPMYADMIN, and also have no problem working in a terminal on my UNIX based (Apple xserve 10.2 Jaguar server).

Thanks!

rich

PS: Please keep it simple!

Revan 11-27-2004 02:39 PM

phpMyAdmin >= 2.6.0-pl2 instructions:
Simply click the button on the left saying "SQL", and you will get a javascript window opened where you can paste the query.
Now in the top row you will see something like "Choose which database to run query on:" and select whatever your vBulletin database is.
Run it, remeber to add a prefix if you use it.

:)

docvader 11-27-2004 08:49 PM

Thanks. Sounds easy, I have no doubt I'll find a way to screw it up though. :)

Gottcha 12-22-2004 05:17 AM

Installed and posted a global message...signed in with different username...no popup although the announcement is in all forums. Using VB3.0.3

Kamex 01-07-2005 10:28 PM

Question: If I do the alter table thing, is that going to cause me to recieve errors the next time I upgrade vbulletin?

dsboyce8624 06-02-2005 02:51 PM

Anybody ever try this on 3.0.7?

quachvu 06-19-2005 01:01 PM

yes, i work on 307, i have tried it!

tekram 12-08-2005 07:35 AM

Quote:

Originally Posted by Gottcha
Installed and posted a global message...signed in with different username...no popup although the announcement is in all forums. Using VB3.0.3

Yes i?m too. Installed and everythink the same as the Problems so Gottcha.
I installed on a 3.0.10

Everybody can help please?

D@rkSt@r 01-11-2006 07:35 PM

iff got the same prob :S


Quote:

Originally Posted by Gottcha
Installed and posted a global message...signed in with different username...no popup although the announcement is in all forums. Using VB3.0.3



All times are GMT. The time now is 12:50 AM.

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.01586 seconds
  • Memory Usage 1,778KB
  • 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_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (20)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete