Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons
(Forumdisplay) Turn off announcements & save 1 query Details »»
(Forumdisplay) Turn off announcements & save 1 query
Version: 1.00, by ThorstenA ThorstenA is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Category: Board Optimization - Version: 3.6.4 Rating:
Released: 01-09-2007 Last Update: Never Installs: 22
 
No support by the author.

(Forumdisplay) Turn off announcements & save 1 query




What does this product do?

This very easy to use product turns off announcements in forumdisplay and saves a whole query each time forumdisplay is presented. Therefore it improves forum speed. There is a discussion in suggestion forum of vbulletin.com to only search for new announcements once a day instead of searching for new announcements each time forumdisplay is presented.

Installation information
  • Files edited: 1
  • Templates edited: 0
  • Files to upload: 0
  • DB Tables changed: 0
  • Additional queries: 0
  • Changed queries: 0
  • Time to install: 60 seconds max

Installation
  1. Open forumdisplay.php
  2. Search for
    Code:
    $announcements = $db->query_read_slave("
    		SELECT
    			announcement.announcementid, startdate, title, announcement.views,
    			user.username, user.userid, user.usertitle, user.customtitle, user.usergroupid,
    			IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid
    			" . (($vbulletin->userinfo['userid']) ? ", NOT ISNULL(announcementread.announcementid) AS readannounce" : "") . "
    		FROM " . TABLE_PREFIX . "announcement AS announcement
    		" . (($vbulletin->userinfo['userid']) ? "LEFT JOIN " . TABLE_PREFIX . "announcementread AS announcementread ON (announcementread.announcementid = announcement.announcementid AND announcementread.userid = " . $vbulletin->userinfo['userid'] . ")" : "") . "
    		LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = announcement.userid)
    		WHERE startdate <= " . TIMENOW . "
    			AND enddate >= " . TIMENOW . "
    			AND " . fetch_forum_clause_sql($foruminfo['forumid'], 'forumid') . "
    		ORDER BY startdate DESC, announcement.announcementid DESC
    		" . iif($vbulletin->options['oneannounce'], "LIMIT 1"));
  3. Delete this code
  4. Save forumdisplay.php


Flagged for future version
  • Put an IF { } statement around this, and create a new setting in vBulletin Options to control whether the Announcement is on or off in Forumdisplay.

Please click Install if you installed this product. So you can get information if product improves. Thank you.



This hack may not be copied, reproduced or published elswhere without my permission.
Please take attention: I take no responsibility for anything of what this product could do anywhere (forum, other software, server ...).

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 01-10-2007, 09:00 PM
ThorstenA's Avatar
ThorstenA ThorstenA is offline
 
Join Date: Nov 2004
Posts: 669
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Reserved for future posts.
Reply With Quote
  #3  
Old 01-10-2007, 09:12 PM
thincom2000 thincom2000 is offline
 
Join Date: May 2006
Location: Bronx, NY
Posts: 1,205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think it may be better to put an IF { } statement around this, and create a new setting in vBulletin Options to control whether the Announcement is on or off in Forumdisplay. That way you can actually use them if you need to, instead of deleting it entirely from the file.
Reply With Quote
  #4  
Old 01-10-2007, 10:54 PM
projectego's Avatar
projectego projectego is offline
 
Join Date: Feb 2006
Location: UK
Posts: 724
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice work, ThorstonA. Thanks.

Just curious though - does implementing this have any negative side-effects?
Reply With Quote
  #5  
Old 01-11-2007, 06:14 AM
ThorstenA's Avatar
ThorstenA ThorstenA is offline
 
Join Date: Nov 2004
Posts: 669
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by thincom2000 View Post
I think it may be better to put an IF { } statement around this, and create a new setting in vBulletin Options to control whether the Announcement is on or off in Forumdisplay. That way you can actually use them if you need to, instead of deleting it entirely from the file.
Flagged for future version
Quote:
Originally Posted by projectego View Post
Nice work, ThorstonA. Thanks.

Just curious though - does implementing this have any negative side-effects?
You do not see announcements on forumdisplay. That's the only effect and it saves one query
Reply With Quote
  #6  
Old 02-05-2007, 04:41 PM
JohnBee JohnBee is offline
 
Join Date: Oct 2004
Posts: 544
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did this MOD, I had 10 queries before I added the mod and I had 10 queries after the edit.
No effect that I can see.
Reply With Quote
  #7  
Old 03-08-2007, 08:59 AM
ThorstenA's Avatar
ThorstenA ThorstenA is offline
 
Join Date: Nov 2004
Posts: 669
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by JohnBee View Post
I did this MOD, I had 10 queries before I added the mod and I had 10 queries after the edit.
No effect that I can see.
It is removing 1 query:
Code:
SELECT
			announcement.announcementid, startdate, title, announcement.views,
			user.username, user.userid, user.usertitle, user.customtitle, user.usergroupid,
			IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid
			" . (($vbulletin->userinfo['userid']) ? ", NOT ISNULL(announcementread.announcementid) AS readannounce" : "") . "
		FROM " . TABLE_PREFIX . "announcement AS announcement
		" . (($vbulletin->userinfo['userid']) ? "LEFT JOIN " . TABLE_PREFIX . "announcementread AS announcementread ON (announcementread.announcementid = announcement.announcementid AND announcementread.userid = " . $vbulletin->userinfo['userid'] . ")" : "") . "
		LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = announcement.userid)
		WHERE startdate <= " . TIMENOW . "
			AND enddate >= " . TIMENOW . "
			AND " . fetch_forum_clause_sql($foruminfo['forumid'], 'forumid') . "
		ORDER BY startdate DESC, announcement.announcementid DESC
		" . iif($vbulletin->options['oneannounce'], "LIMIT 1")
Reply With Quote
  #8  
Old 03-16-2007, 04:06 PM
Zia's Avatar
Zia Zia is offline
 
Join Date: Dec 2005
Location: golpo.net
Posts: 931
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

any vb developer has anything to say about it?
Reply With Quote
  #9  
Old 03-22-2007, 08:54 AM
ThorstenA's Avatar
ThorstenA ThorstenA is offline
 
Join Date: Nov 2004
Posts: 669
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zia View Post
any vb developer has anything to say about it?
vb Team is looking forward to put this query into datastore (or something like that) and just run this query once a day instead of every time forumdisplay is presented to user. Could be integrated into next smaller vbulletin update.
Reply With Quote
  #10  
Old 08-04-2009, 11:28 PM
Fenriz Fenriz is offline
 
Join Date: Aug 2002
Posts: 126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
vb Team is looking forward to put this query into datastore (or something like that) and just run this query once a day instead of every time forumdisplay is presented to user. Could be integrated into next smaller vbulletin update.
Has that been done in 3.7.x?
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:03 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.04662 seconds
  • Memory Usage 2,291KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete