1

Topic: [Mod] Subject of last post on index

Sorry for my english.

Exemple : CtrlAltSuppr.com

*****************************
IN INDEX.PHP
****************************

Line 42, replace :

$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 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'].') 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());

Per :

$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 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'].') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

Line 109, replace :

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

Per :

    // Afficher le titre du dernier topic
    $queryid = $db->query('SELECT topic_id FROM '.$db->prefix.'posts WHERE id='.$cur_forum['last_post_id']);
    $idm = $db->result($queryid);
    $queryid = $db->query('SELECT subject FROM '.$db->prefix.'topics WHERE id='.$idm);
    $idm = $db->result($queryid);
    if(strlen($idm) > 30) {
        $idmComp = str_replace('"', "''", $idm);
        $idm = substr($idm, 0, 30).'...';
    } else
        $idmComp = '';

    // If there is a last_post/last_poster.
    if ($cur_forum['last_post'] != '') {
        $idmT = (isset($idmComp)) ? ' title="'.$idmComp.'"' : '';
        $last_post = format_time($cur_forum['last_post']).'<br />dans <a href="viewtopic.php?pid='.$cur_forum['last_post_id'].'#p'.$cur_forum['last_post_id'].'"'.$idmT.'><em>'.$idm.'</em></a><br /><span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'</span>';
    } else
        $last_post = ' ';

2

Re: [Mod] Subject of last post on index

Hi.

Nice code smile
I can se you are using some fantastic smilyes in your forum.
Would you please send them to me (the pictures in the image gallery in the forum files)
You can send them to my mail:
lasse.qxl@jubii.dk

Thanks.
Best regards Lasse.

Re: [Mod] Subject of last post on index

Added to punres wiki smile http://punres.org/doku.php?id=how-tos:s … t_on_index

Re: [Mod] Subject of last post on index

Connorhd: Remind me to write up a news post on the Wiki. It's turning into a really good resource. Good job smile

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

Re: [Mod] Subject of last post on index

Someone else did this mod but this one is better. smile

Re: [Mod] Subject of last post on index

Rickard wrote:

Connorhd: Remind me to write up a news post on the Wiki. It's turning into a really good resource. Good job smile

wooo i knew if i spammed it enough it would get noticed wink