MyBB Community Forums

Full Version: Call Individual Forums
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys!

I was wondering if anyone knew how to get the name, description, and last post of forums by ID? I'm using template conditionals to code my forums under forumbit_depth2_forum based on their exact forum ID, and I wanted to code the subforums to drop down accordion style.

<if $forum['fid'] == 7 then> Coding in here for individual forum </if>

Since there's no way to wrap the div code I want around the subforums individually, I opted to just calling the forums by ID, but I can't figure out how to do it? I need: {$forum['name']}{$forum['description']}, and {$lastpost} for fid 13, 14, 15, and 16.

I guess I could just hard code them in, but lastpost is essential (and also something I'm not entirely sure is possible at all from what I know of lastpost).

Any ideas or input would be immensely appreciated!
you can try basic code from this guidance & use required display style through templates

or you can try adopting basic code from Recent Threads On Index plugin
Thanks for the fast reply!

This is a good find.

Do I have to run a query to get last posts by forum ID's though? I'll do it if I have to, it's just really inconvenient when I need to run a query for each individual forum.

EDIT: Where can I find the code for last post?
EDIT: Looks like functions_forumlist.php
query can consist of logic like below
WHERE ___________ 
AND t.fid IN (13, 14, 15, 16) 

individual result from each query needs to be added to final display related variables
(depending on your display requirement)
Well, I fixed my issue by using the forum_depth3 template around the accordion code. Now I'm getting the name and description of all subforums beneath the main forum — however I still need the last post.

From what I see in the functions_forumlist.php file, it prevents subforums from listing the last post individually on the index. Instead, it displays the last post made among all those subforums inside the parent forum.

I realize that I can run a db query with multiple forum ID's, but I'm asking if I have to do that at all. Is there any way to bypass that and just call the lastpost for subforums?