MyBB Community Forums

Full Version: Get the amount of posts the user has made today?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Quite simply, I wish to get the amount of posts the user has made today. Is there an easy way to do this? Thanks!
Do you want to get this information just from within your database (e.g. via phpmyadmin) or do you want it displayed in the forum/user profiles, etc.?

The search function http://community.mybb.com/search.php allows to select for a username and a date range (select "from yesterday" plus "and newer").
I just want to get it from database currently, I'd know how to display it on user profiles and whatever if I had a database query. I'll take a look at that search script though.
Today or the last 24 hours?

Today is starting from midnight until now and while the last 24 hours is something different.
You can use PHP?
// last 24 hours
$dateline = time() - 86400;
$uid = intval($memprofile['uid']);
$db->query("SELECT COUNT(pid) AS num FROM mybb_posts WHERE uid='$uid' AND dateline > $dateline");

// today
$dateline = strtotime("midnight");
$uid = intval($memprofile['uid']);
$db->query("SELECT COUNT(pid) AS num FROM mybb_posts WHERE uid='$uid' AND dateline > $dateline");
That did it perfectly. Thank you!
(2011-05-11, 12:58 PM)Katrin Wrote: [ -> ]That did it perfectly. Thank you!

You're welcome Wink