View Full Version : DB Query to get a users postcount # in the past 24 hours?
Hi, I have tried a few things and none of them worked. I am trying to show the number of posts each user has made in the past 24 hours in their profile. I know there is a simple query for this because I have seen versions of it in some hacks here. I just couldn't modifiy those to work with my forums for some reason. All I need is the query.
Please help. :)
Chris Gwynne
03-21-2003, 11:39 PM
There's a default variable within vB that will show the average amount of posts for that user, per day. Will that help you? :)
I was looking for that but couldn't find it. That would be a start I think... Do you know where it is?
If you're OK to add another query to whatever page that is, use:
$cutoff=time()-86400;
$postcount=$DB_site->query_first("SELECT COUNT(*) AS total FROM post WHERE userid='$userid' AND dateline >= $cutoff");
Then insert $postcount[total] where you need it to appear.
Thanks N!ck! That was it. Yeah I'm jsut using it for the getinfo page so there's not too much to worry about query-wise. Thanks.
:)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.