Fixed viewforum. Now shows correct last post info and topic starter

git-svn-id: file:///svn/phpbb/trunk@98 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
James Atkinson 2001-03-11 02:31:05 +00:00
parent dafd3e778c
commit f276636450
2 changed files with 8 additions and 3 deletions

View file

@ -8,6 +8,7 @@
<td width="5%">&nbsp;</td> <td width="5%">&nbsp;</td>
<td>Topic</td> <td>Topic</td>
<td align="center" width="5%">Replies</td> <td align="center" width="5%">Replies</td>
<td align="center" width="10%">Topic Poster</td>
<td align="center" width="5%">Views</td> <td align="center" width="5%">Views</td>
<td align="center" width="15%">Last Post</td> <td align="center" width="15%">Last Post</td>
</tr> </tr>
@ -16,6 +17,7 @@
<td width="5%" align="center" valign="middle">{FOLDER}</td> <td width="5%" align="center" valign="middle">{FOLDER}</td>
<td><a href="viewtopic.{PHPEX}?{POST_TOPIC_URL}={TOPIC_ID}&{REPLIES}">{TOPIC_TITLE}</a></td> <td><a href="viewtopic.{PHPEX}?{POST_TOPIC_URL}={TOPIC_ID}&{REPLIES}">{TOPIC_TITLE}</a></td>
<td width="5%" align="center" valign="middle">{REPLIES}</td> <td width="5%" align="center" valign="middle">{REPLIES}</td>
<td width="10%" align="center" valign="middle">{TOPIC_POSTER}</td>
<td width="5%" align="center" valign="middle">{VIEWS}</td> <td width="5%" align="center" valign="middle">{VIEWS}</td>
<td width="15%" align="center" valign="middle">{LAST_POST}</td> <td width="15%" align="center" valign="middle">{LAST_POST}</td>
</tr> </tr>

View file

@ -81,10 +81,11 @@ if(!isset($start))
$start = 0; $start = 0;
} }
$sql = "SELECT t.*, u.username, u.user_id, p.post_time $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time
FROM " . TOPICS_TABLE ." t FROM " . TOPICS_TABLE ." t
LEFT JOIN ". USERS_TABLE. " u ON t.topic_poster = u.user_id LEFT JOIN ". USERS_TABLE. " u ON t.topic_poster = u.user_id
LEFT JOIN ".POSTS_TABLE." p ON p.post_id = t.topic_last_post_id LEFT JOIN ".POSTS_TABLE." p ON p.post_id = t.topic_last_post_id
LEFT JOIN " . USERS_TABLE . " u2 ON p.poster_id = u2.user_id
WHERE t.forum_id = '$forum_id' WHERE t.forum_id = '$forum_id'
ORDER BY topic_time DESC ORDER BY topic_time DESC
LIMIT $start, $topics_per_page"; LIMIT $start, $topics_per_page";
@ -102,18 +103,20 @@ if($total_topics)
$topic_title = stripslashes($topic_rowset[$x]["topic_title"]); $topic_title = stripslashes($topic_rowset[$x]["topic_title"]);
$topic_id = $topic_rowset[$x]["topic_id"]; $topic_id = $topic_rowset[$x]["topic_id"];
$replies = $topic_rowset[$x]["topic_replies"]; $replies = $topic_rowset[$x]["topic_replies"];
$topic_poster = stripslashes($topic_rowset[$x]["username"]);
$views = $topic_rowset[$x]["topic_views"]; $views = $topic_rowset[$x]["topic_views"];
$last_post_time = date($date_format, $topic_rowset[$x]["post_time"]); $last_post_time = date($date_format, $topic_rowset[$x]["post_time"]);
$last_post_user = $topic_rowset[$x]["username"]; $last_post_user = $topic_rowset[$x]["user2"];
$folder_img = "<img src=\"images/folder.gif\">"; $folder_img = "<img src=\"images/folder.gif\">";
$template->set_var(array("FORUM_ID" => $forum_id, $template->set_var(array("FORUM_ID" => $forum_id,
"POST_TOPIC_URL" => POST_TOPIC_URL, "POST_TOPIC_URL" => POST_TOPIC_URL,
"TOPIC_ID" => $topic_id, "TOPIC_ID" => $topic_id,
"FOLDER" => $folder_img, "FOLDER" => $folder_img,
"TOPIC_POSTER" => "<a href=\"profile.$phpEx?mode=viewprofile?user_id=".$topic_rowset[$x]["user_id"]."\">".$topic_poster."</a>",
"REPLIES" => $replies, "REPLIES" => $replies,
"TOPIC_TITLE" => $topic_title, "TOPIC_TITLE" => $topic_title,
"VIEWS" => $views, "VIEWS" => $views,
"LAST_POST" => $last_post_time . "<br><a href=\"profile.$phpEx?mode=viewprofile?user_id=".$topic_rowset[$x]["user_id"]."\">" . $last_post_user ."</a>")); "LAST_POST" => $last_post_time . "<br><a href=\"profile.$phpEx?mode=viewprofile?user_id=".$topic_rowset[$x]["id2"]."\">" . $last_post_user ."</a>"));
$template->parse("topics", "topicrow", true); $template->parse("topics", "topicrow", true);
} }
$count = 1; $count = 1;