MyBB Community Forums

Full Version: Count number of posts in particular forums
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I know how many posts and threads User A has created overall. But let's say I want to know specifically how many posts User A has made in Forum C. What if I wanted to retrieve this value on a regular interval? Is there a way to do this without slowing the board down a lot?

Thanks.
Code you'd want is this:

$query = $db->simple_select("posts", "COUNT(*) AS posts", "uid = '" . intval($uid) . "' AND fid = '" . intval($fid) . "'");
$posts = $db->fetch_field($query, "posts");

Shouldn't slow the board down really.
Thank you. The reason I ask this is because I was thinking about a modification to the My Achievements plugin, so users are awarded achievements for an amount of posts in a particular forum, rather than all of their posts collectively.

If you read this thread you will see that I have discussed this with the author, who said it would be too intensive. I guess this is due to how the plugin is developed? I am not a developer, so I apologise for my lack of knowledge but I am asking about whether this is a possibility because I'd consider paying a developer to do this if it is indeed possible.