Forums / Cotonti / Extensions / Help on a plugin that shows top posters

Twiebie
#35043 2012-07-31 17:53

I want to create a little plugin that shows the weekly top posters in a list.

I've grabbed a bit of code from the forum stats plugin to get started, but now i'm wondering how I can get/specify the users post count for a specific timespan (a week for example).

$res = $db->query("SELECT user_id, user_name, user_postcount FROM $db_users WHERE 1 ORDER by user_postcount DESC LIMIT 10");

foreach ($res->fetchAll() as $row) {
	$t1->assign(array(
		'TOPPOSTERS_NAME' => cot_build_user($row['user_id'], htmlspecialchars($row['user_name'])),
		'TOPPOSTERS_POSTS' => $row["user_postcount"],
	));
}

Thanks.