View Full Version : [release] Ammount of new posts since last visit :)
Zachery
11-14-2003, 04:31 AM
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/mods/showpost.php?p=39805&postcount=8
live @ http://www.digitalkore.net (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 :)
http://www.vbulletintemplates.com/mods/showthread.php?t=1572
Asuming the db hasent changed more then I think it has from vB 2 this query should help out larger boards:
ALTER TABLE post ADD INDEX('dateline')
Zachery
11-15-2003, 03:22 AM
how so brad?
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?
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:
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
imported_ogden2k
11-21-2003, 02:27 PM
Would it matter if I don't show this for guests? Just members?
Also, what is considered a large board?
Zachery
11-21-2003, 02:28 PM
i would definatly not show this for guests, as they wouldnt get a correct read if at all, but it would still preform the querrys, which are rather intensive
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
Noted, thanks for letting me know. :)
Zachery
12-01-2003, 04:35 AM
btw i like your new avie brad :D
Platinum [JSI]
12-03-2003, 07:16 PM
Cheers, worked great :D
Zachery
12-09-2003, 11:36 PM
this works in gamma if, just put it in the navbar now
ill post an update for this in abit ^^
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.