Topic: Can I show the last post?

Am I able to add a column on the index page to show the last post from any forum so that users can see the title of the most recent discussion?

Thanks for your help :-)

2 (edited by tres 2005-01-21 17:11)

Re: Can I show the last post?

This worked for me, use it at your own risk.

Change line 42 of index.php to

$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster, t.subject FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') left join '.$db->prefix.'topics as t on (f.last_post_id=t.last_post_id) WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

change line 110 of index.php to

$last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.$cur_forum['subject'].'</a><br />'.format_time($cur_forum['last_post']).'<br />'.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']);

Re: Can I show the last post?

You forgot to run pun_htmlspecialchars() on the subject though.

"Programming is like sex: one mistake and you have to support it for the rest of your life."