MyBB Community Forums

Full Version: Post # in specific forum?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using template conditionals and want to get the user's posts # from a specific forum.

{$user['postnum']}

Is the call for posts, but would I need to use a query to grab the # of posts in a specific FID?

Thanks!
Yes, you would. Smile

$query = $db->write_query("SELECT * FROM `mybb_posts` WHERE `fid`='" . $fid . "' AND `uid`='" . $mybb->user['uid'] . "'");

$num_posts = $db->num_rows($query);

If you are experiencing problems, replace " . $fid . " (including double quotations) with the fid of the forum.
Ok, will apply that now but one more question. How could I grab the group's FID automatically. This is regarding the Posts # in Group Management. I don't want the total posts to be displayed but what they've posted in that forums specifically.

(2013-04-28, 11:36 PM)Seabody Wrote: [ -> ]Yes, you would. Smile

$query = $db->write_query("SELECT * FROM `mybb_posts` WHERE `fid`='" . $fid . "' AND `uid`='" . $mybb->user['uid'] . "'");

$num_posts = $db->num_rows($query);

If you are experiencing problems, replace " . $fid . " (including double quotations) with the fid of the forum.

Tested as is, even replaced UID and FID to see why it wasn't working, but Posts: 0 all throughout.
I still need help on this, lost on how to do it and the query Seabody gave me doesn't work either. :/

Thanks,
Hydra