MyBB Community Forums

Full Version: Showing the amount of posts a user has posted today -> advanced stats
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I am working on my advanced stats script right now, did something in the past which has to be improved to be released.

Right now it shows how many posts & threads have been written by how many users in the last X days, where X can be set bei the user (from 1-9999)

What I want to do right now ist to show how many posts have been written by the user who is online/asking right now. So there are no restrictions, he should just know how many posts he has written today.

This is, what I have:


			// Get the number of posts by this user
			$query = $db->simple_select("posts", "COUNT(uid) AS yourposts", "dateline > '$timecut'");
			$yourposts = my_number_format($db->fetch_field($query, "yourposts"));

Actually, this shows how many posts have been written in this amount of time, but how can I define, that just the UID X is counted?

I already put a " $UID = $mybb->user['uid'];" so I have the UID, does this help?
Smile

I hope, I make myself clear and somebody can help me!

thanks a lot,
regards,
FraGe
(2009-12-07, 12:54 PM)FraGe Wrote: [ -> ]Hello,

I am working on my advanced stats script right now, did something in the past which has to be improved to be released.

Right now it shows how many posts & threads have been written by how many users in the last X days, where X can be set bei the user (from 1-9999)

What I want to do right now ist to show how many posts have been written by the user who is online/asking right now. So there are no restrictions, he should just know how many posts he has written today.

This is, what I have:


			// Get the number of posts by this user
			$query = $db->simple_select("posts", "COUNT(uid) AS yourposts", "dateline > '$timecut'");
			$yourposts = my_number_format($db->fetch_field($query, "yourposts"));

Actually, this shows how many posts have been written in this amount of time, but how can I define, that just the UID X is counted?

I already put a " $UID = $mybb->user['uid'];" so I have the UID, does this help?
Smile

I hope, I make myself clear and somebody can help me!

thanks a lot,
regards,
FraGe

You just have to replace your "WHERE" statement of "dateline > '$timecut'" to "dateline > '$timecut' AND uid = '$UID'" Wink
Sometimes it's that easy ....

Thanks a lot, it worked perfectly. (But I had to replace $UID by $USR - there is some UID around somewhere Wink)