MyBB Community Forums

Full Version: Latest posts custom page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to display a couple of latest posts from a specific section/forum on my forum. I see there are codes to display the globalized last post, but nothing to display what I am needing. Which is the above.
That's a global list of latest posts. I need something that is for a specific forum on my MyBB board.
What about this:
$query = $db->query("SELECT p.*, u.username FROM " . TABLE_PREFIX . "posts p LEFT JOIN " . TABLE_PREFIX . "users u ON(p.uid=u.uid) WHERE p.fid IN(1,2,3) ORDER BY p.dateline DESC LIMIT 10");
while($post = $db->fetch_array($query))
{
// Code here
}

Replace 1,2,3 with the ids of the forums you wish to pull from.