Version: , by MrLister
Developer Last Online: Oct 2012
Version: 2.2.x
Rating:
Released: 10-31-2001
Last Update: Never
Installs: 85
No support by the author.
Somebody here request it so I made it quickly.... Basically this hack here tells your users how many new posts and threads there have been since hteir last visit on the main page.
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]'");
$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post WHERE dateline > '$bbuserinfo[lastvisit]'");
In the template forumhome_welcometext find:
PHP Code:
Welcome back, <b>$bbuserinfo[username]</b>
right under it add:
PHP Code:
<br>There have been <b>$getnewthread[threads]</b> threads and <b>$getnewpost[posts]</b> posts since your last visit!
That's it! If you installed the hack please click the install button!
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
Yes...sorry to say for some reason this nice feature totally trashed my DB server. Actually pegs out my CPU's on the DB server only for it seems to have to count of something way too much. Currently 732 users on line. Upload index.php...crash! Ver 2.2.4
The load of a COUNT-Statement is far too high on busy servers.
It will delay your forumshome by several seconds (!) and put an enormous load on the poor database.
If your fora are quite busy (>100 ppl online), I would disencourage you of using this hack.
Unfortunately I am no sql Guru. There is for sure a way to form a statement less ressource intensive but I am afraid I can only critizise not help
Maybe anyone can jump in here?
BTW: Allthough I may sound a bit harsh here (which I am not, I hope), I really appreciate everyone releasing hacks and I know it's sometimes really a mess to deal with, so please don't feel offended
Originally posted by mister
The way it works now, this hack counts threads & posts in EVERY forum, private forums included.
Is there an easy way to not count those forums the user doesn't have access to?
Some of my users are confused, because it says 12 threads, but they're only getting 10 back (2 are in private forums).
Easy fix, here is your solution
into your SQL request, use this instead of original code:
Code:
$getnewthread=$DB_site->query_first("SELECT COUNT(*) AS threads FROM thread WHERE lastpost > '$bbuserinfo[lastvisit]' and forumid <> 'id of your private forum'");
$getnewpost=$DB_site->query_first("SELECT count(*) AS posts FROM post,thread WHERE post.dateline > '$bbuserinfo[lastvisit]' and thread.threadid=post.threadid and thread.forumid <> 'id of your private forum'");
Of course, this is only a temp solution, and it should have to be improved for the vb3 environement.
(auto don't count for all private forum by adding a checkbox, etc...)
Agreed.. I have at time 130-160 online at a time, it put a LARGE load on the CPU's and slowed the forums considerably. Nice hack for smaller boards though!