Wp themes - Debt Consolidation - Debt Consolidation - Discount Perfume - Song Lyrics A to Z

PDA

View Full Version : phpbb biggest (perhaps) drawback solved


king_cobra
Sep 21st 2005, 3:38 am
Hi all,

I was working with phppb for some two days now. and as u can see from my previous posts i was constantly bugging people for tips. anyway, as necessity is the mother of invention, i found a way out of the biggest draw back (for me, atleast) of phpbb. that is not showing the last post topic title in the forum index page. So let me share the mod with all those who want the last post topic title to be shown in forum index.

Find in forum_root_folder/index.php

default:
$sql = "SELECT f.*, t.topic_id, t.topic_title, p.post_time, p.post_username, u.username, u.user_id
FROM (( " . FORUMS_TABLE . " f
LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
ORDER BY f.cat_id, f.forum_order";
break;

Replace with

default:
$sql = "SELECT f.*, t.topic_id, t.topic_title, p.post_time, p.post_username, u.username, u.user_id
FROM ((( " . FORUMS_TABLE . " f
LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
LEFT JOIN " . TOPICS_TABLE. " t ON t.topic_id = p.topic_id)
ORDER BY f.cat_id, f.forum_order";
break;

Find

if ( $forum_data[$j]['forum_last_post_id'] )
{
$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);

$last_post = $last_post_time . '<br />';

$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';

$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
}

Replace with

if ( $forum_data[$j]['forum_last_post_id'] )
{
$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);

$last_post = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $forum_data[$j]['topic_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '" title="' . $forum_data[$j]['topic_title'] . '">' .$forum_data[$j]['topic_title']. '</a>' . '<br /> by ';

$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : $forum_data[$j]['username'];

$last_post .= '<br />'. $last_post_time;
}

there is no need to edit the template file.

Hope you enjoy it. You are free to use this, share this, but if you prefer to give someone a link to the mod, please give the link to this thread.

Thankyou.
Any doubt, just post here.

yfs1
Sep 21st 2005, 3:46 am
There is also an official Mod here:
http://www.phpbb.com/phpBB/viewtopic.php?p=1581805#1581805

king_cobra
Sep 21st 2005, 3:51 am
I had tested that one, but it uses a seperate sql query to fetch the title. why have a seperate query done when it can be done in the same query set?

RectangleMan
Sep 21st 2005, 5:29 pm
Not bad...I added substr to the forum title so it doesn't break layout.

http://www.360forum.com/forums/ for demo

king_cobra
Sep 22nd 2005, 10:24 am
cool idea labrocca. thaks for it.