1

Topic: Last Topic instead of date on forum index page

On the forum index page, how can i add the last posted topic in that forum above the date that currently displays or change it so the last posted topic displays instead of the date?

I've searched for the answer to this question, and i haven't been ablet to find one. So if i missed it, forgive me..

Ennis

Ennis
Website: ThisIsEnnis.com | Email: ThisIsEnnis
[img]http://www.thisisennis.com/wp-images/sig.jpg[/img]

Re: Last Topic instead of date on forum index page

Moved to modifications.

http://wiki.punres.org/Last_post%27s_su … orum_index

Use fpouget's code. The whole thing can be done a little more simply, but it works.

Looking for a certain modification for your forum? Please take a look here before posting.

3

Re: Last Topic instead of date on forum index page

pogenwurst wrote:

Moved to modifications.

http://wiki.punres.org/Last_post%27s_su … orum_index

Use fpouget's code. The whole thing can be done a little more simply, but it works.

I get an error when i try to use fpouget's code. Category/subject could not be found error to be exact

Whats the simplier way?

Ennis
Website: ThisIsEnnis.com | Email: ThisIsEnnis
[img]http://www.thisisennis.com/wp-images/sig.jpg[/img]

Re: Last Topic instead of date on forum index page

Replace the query with the following:

// Print the categories and forums
$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_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 INNER JOIN topics AS t ON f.last_post_id=t.last_post_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_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());

Replace the $last_post conditional with the following:

    // If there is a last_post/last_poster.
    if ($cur_forum['last_post_id'] != '' && $pun_config['o_censoring'] == '1')
        $last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.censor_words(pun_htmlspecialchars($cur_forum['subject'])).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'</span>';
    elseif ($cur_forum['last_post_id'] != '' && $pun_config['o_censoring'] == '0')
        $last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.pun_htmlspecialchars($cur_forum['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'</span>';
    else
        $last_post = ' ';

Edit: I just realized that I forgot to add code to clip overly long topic subjects. I will do so soon.

Looking for a certain modification for your forum? Please take a look here before posting.

5

Re: Last Topic instead of date on forum index page

pogenwurst wrote:

Replace the query with the following:

// Print the categories and forums
$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_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 INNER JOIN topics AS t ON f.last_post_id=t.last_post_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_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());

Replace the $last_post conditional with the following:

    // If there is a last_post/last_poster.
    if ($cur_forum['last_post_id'] != '' && $pun_config['o_censoring'] == '1')
        $last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.censor_words(pun_htmlspecialchars($cur_forum['subject'])).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'</span>';
    elseif ($cur_forum['last_post_id'] != '' && $pun_config['o_censoring'] == '0')
        $last_post = '<a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'">'.pun_htmlspecialchars($cur_forum['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'</span>';
    else
        $last_post = ' ';

Edit: I just realized that I forgot to add code to clip overly long topic subjects. I will do so soon.

Same Error:
Error: Unable to fetch category/forum list.

Ennis
Website: ThisIsEnnis.com | Email: ThisIsEnnis
[img]http://www.thisisennis.com/wp-images/sig.jpg[/img]

Re: Last Topic instead of date on forum index page

Can you please enable debug mode and paste the error?

Looking for a certain modification for your forum? Please take a look here before posting.