vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   [release] Ammount of new posts since last visit :) (https://vborg.vbsupport.ru/showthread.php?t=88344)

Zachery 11-14-2003 04:31 AM

[release] Ammount of new posts since last visit :)
 
1 Attachment(s)
This should be a simple one,

This will show how many new posts there have been since a persons last visit, this now does show the ammount of new threads too, silly me, i forgot to update the varible when i copied the posts querry :D

this will add 2 queries to your forumhome, however i must warn that with this even only running on the forumhome, these queries might still be rather large if you have a very active forum. at least from what i understand :)

updated with brads suggestion

id also take a look at this post as you may wish to include this into this template mod
http://www.vbulletintemplates.com/mo...05&postcount=8

live @ http://www.digitalkore.net

imported_ogden2k 11-14-2003 09:49 PM

Excellent addon!

Zachery 11-14-2003 09:50 PM

i belive assassingod made it hackable, i try to stay away from hacking files when i can help it :)

Brad 11-15-2003 03:21 AM

http://www.vbulletintemplates.com/mo...ead.php?t=1572

Asuming the db hasent changed more then I think it has from vB 2 this query should help out larger boards:

Code:

ALTER TABLE post ADD INDEX('dateline')

Zachery 11-15-2003 03:22 AM

how so brad?

Brad 11-15-2003 03:26 PM

Quote:

Originally Posted by Faranth
how so brad?

It will create a index in the database on the post table, the records are sorted by dateline. So when index.php is loaded vB's mysql has a index it can look at and retrive the records from, this is faster then having mySQL search the post table on every page load. However the trade off is that the index will take up some extra space in the database.

Zachery 11-15-2003 04:06 PM

so would the querys need to be changed at all?

Brad 11-16-2003 06:35 AM

1 Attachment(s)
Quote:

Originally Posted by Faranth
so would the querys need to be changed at all?

No, the query I posted will work with the modification as is. And should only be run once on the database.

Ive attached a php script that will do it for you, just upload it to the admincp directory and it should work.

Also you can cut down on alot of load by not running the querys for guests, to do so change the php block to this:

PHP Code:


if (THIS_SCRIPT == 'index' and $bbuserinfo['userid'] !== '0'
{
// Posts
$getnewposts $DB_site->query_first("SELECT COUNT(*) AS count FROM " TABLE_PREFIX "post WHERE dateline >= '$bbuserinfo[lastvisit]'");
$newposts number_format($getnewposts['count']);
// Threads
$getnewthreads $DB_site->query_first("SELECT COUNT(*) AS count FROM " TABLE_PREFIX "thread WHERE dateline >= '$bbuserinfo[lastvisit]'");
$newthreads number_format($getnewthreads['count']);


Boards that have converted their tables to innodb should avoid this modification also, it uses the count function which is slow under innodb, considering vBulletin uses count on these tables alot anyway this will only pour salt in a open wound.

Im not trying to bash this modification, you just have to be real careful when releasing/installing something like this, because it dose open the door up to all sorts of server load problems if not added correctly..

Zachery 11-16-2003 06:55 AM

thanks brad, ill update my txt and point users to your attachment :)


im more than aware of this :\ and i didnt think about disabling it for guests, sliped my mind which i should know better as i already turn alot of things off for guests.

i do belive i did give somewhat of a warning however

i updated the txt instuctions to check for guests as well and redid abit of the html to make it look abit nicer to users who are guests :)

Zachery 11-17-2003 10:29 PM

brad i noticed a small error in your coding when for !== would still show for guests while != will not run the querry for guests, ive updated my txt file :) anyone who installed this should update their phpinclude_start tempalte :D


All times are GMT. The time now is 01:37 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.01202 seconds
  • Memory Usage 1,739KB
  • 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
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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