1

Topic: !! Improving Form Display

Hey, this is about improving what is shown on the index.

I know that the links to the recent posts use "$cur_forum[]". I would like to add the recent topic title, and make the last post's user name to be linkable.

The problem is, I don't know if the variables exist to do that. If they do, what are they? If they don't, how could I make these variables exist, or just get that information?

Thanks smile

Re: !! Improving Form Display

Replace applicable code blocks with:

// 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, f.last_post_id, f.last_poster, u.id AS uid, t.subject FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id INNER JOIN '.$db->prefix.'users AS u ON f.last_poster = u.username INNER JOIN '.$db->prefix.'topics AS t ON t.last_post_id = f.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());
    // 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'].'">'.pun_htmlspecialchars($cur_forum['subject']).'</a> <span class="byuser">'.$lang_common['by'].' <a href="profile.php?id='.$cur_forum['uid'].'">'.pun_htmlspecialchars($cur_forum['last_poster']).'</a></span>';
    else
        $last_post = ' ';
Looking for a certain modification for your forum? Please take a look here before posting.

3

Re: !! Improving Form Display

Thanks smile Worked just fine.

4

Re: !! Improving Form Display

Ummm, I forgot to mention it, but forums with no posts in it don't show up at all now. It isn't a major problem, but it is an inconvienience. Can anyone see the problem here?

I looked for it, but didn't find it...

Re: !! Improving Form Display

Try doing a LEFT JOIN for topics instead of an INNER JOIN.

Re: !! Improving Form Display

Hey, I applied this mod and it works okay, but the fact that forums with no posts are hidden is quite a problem for me (new forum, not public yet). I tried using LEFT JOIN instead of INNER JOIN for topics, but it didn't make any difference. Is there a way I can fix this? smile

Re: !! Improving Form Display

Anyone?

Re: !! Improving Form Display

Bump.. really need to know this...

Re: !! Improving Form Display

Both users and topics should be a left join

10

Re: !! Improving Form Display

Still doesn't work...

Re: !! Improving Form Display

Post your code