Assuming that you know WHERE & HOW to put this code, (Its just like the ont you did for Latest Threads, follow the same steps, just the code is different
)
Change the code you replaced earlier incase of LATEST threads to:
// get forums user cannot view
$unviewable = get_unviewable_forums(true);
if($unviewable)
{
$unviewwhere = " AND fid NOT IN ($unviewable)";
}
$altbg = alt_trow();
$threadlist = '';
$query = $db->query("
SELECT t.*, u.username, u.displaygroup, u.avatar, u.usergroup, u.avatardimensions, f.name AS forumname, lp.avatar as lpavatar, t.username AS threadusername
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
LEFT JOIN ".TABLE_PREFIX."users lp ON (lp.uid=t.lastposteruid)
LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=t.fid)
WHERE 1=1 $unviewwhere AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND t.poll > 0
ORDER BY t.lastpost DESC
LIMIT 0, 10"
);
while($thread = $db->fetch_array($query))
{
$lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
$lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
// Don't link to guest's profiles (they have no profile).
if($thread['lastposteruid'] == 0)
{
$lastposterlink = $thread['lastposter'];
}
else
{
$lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
}
if($thread['lpavatar'])
{
$thread['lpavatar'] = htmlspecialchars_uni($thread['lpavatar']);
}
else
{
$thread['lpavatar'] = $mybb->settings['bburl']."/images/default_avatar.gif"; $thread['avatardimensions'] = "45|45";
}
if(my_strlen($thread['subject']) > 100)
{
$thread['subject'] = my_substr($thread['subject'], 0, 100) . "...";
}
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
$thread['threadlink'] = get_thread_link($thread['tid']);
$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
$thread['username'] = $thread['threadusername'];
$threadstarter = build_profile_link($thread['username'], $thread['uid']);
$threadender = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
$thread['profilelink'] = $thread['threadusername'];
eval("\$threadlist .= \"".$templates->get("portal_latestpolls_poll")."\";");
$altbg = alt_trow();
}
if($threadlist)
{
// Show the table only if there are threads
eval("\$latestposts = \"".$templates->get("latestposts")."\";");
}
Now you have pulled out all the required stuff
Create a new template, name it "latestposts". Enter your HTML code as required.
All the variables you can use here:
{$thread['subject']} = Threads Subject
{threadstarter} = Thread Starter
{threadender} = The Last Poster
{$thread['lastpostlink']} = Last Post LINK, use it as <a href="{$thread['lastpostlink']}">{$thread['subject']}</a>
{$thread['lpavatar']} = Last Posters Avatar
{$thread['lastposter']} = Last Posters USERNAME Only
{$thread['threadlink']} = Main Thread LINK
Enjoy