TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,911
  • Total Topics: 21,307
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 679
  • Total: 679

Sort frontpage posts differently

Started by janilxx, December 07, 2007, 06:03:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cypher223

Well u don't have to worry anymore IchBin. I have fixed it myself. If anyone need this. The code edits are given below.

Open $boarddir/Sources/TPortal.php

Search for


// Find the post ids.
$request = db_query("
SELECT t.ID_FIRST_MSG
FROM ({$db_prefix}topics as t, {$db_prefix}boards as b)
WHERE t.ID_BOARD IN (". $board .")
AND t.ID_BOARD=b.ID_BOARD
AND $user_info[query_see_board]
ORDER BY t.ID_FIRST_MSG DESC
LIMIT $start, $limit", __FILE__, __LINE__);
$posts = array();
while ($row = mysql_fetch_assoc($request))
$posts[] = $row['ID_FIRST_MSG'];
mysql_free_result($request);

if (empty($posts))
return array();

// Find the posts.
$request = db_query("
SELECT
m.icon, m.subject, m.body, IFNULL(mem.realName, m.posterName) AS posterName, m.posterTime,
t.numReplies, t.ID_TOPIC, m.ID_MEMBER, m.smileysEnabled, m.ID_MSG, t.locked, t.numViews,t.numReplies
FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE t.ID_FIRST_MSG IN (" . implode(', ', $posts) . ")
AND m.ID_MSG = t.ID_FIRST_MSG
ORDER BY t.ID_FIRST_MSG DESC
LIMIT " . count($posts), __FILE__, __LINE__);



And Replace with this


// Find the post ids.
$request = db_query("
SELECT t.ID_LAST_MSG
FROM ({$db_prefix}topics as t, {$db_prefix}boards as b)
WHERE t.ID_BOARD IN (". $board .")
AND t.ID_BOARD=b.ID_BOARD
AND $user_info[query_see_board]
ORDER BY t.ID_LAST_MSG DESC
LIMIT $start, $limit", __FILE__, __LINE__);
$posts = array();
while ($row = mysql_fetch_assoc($request))
$posts[] = $row['ID_LAST_MSG'];
mysql_free_result($request);

if (empty($posts))
return array();

// Find the posts.
$request = db_query("
SELECT
m.icon, m.subject, m.body, IFNULL(mem.realName, m.posterName) AS posterName, m.posterTime,
t.numReplies, t.ID_TOPIC, m.ID_MEMBER, m.smileysEnabled, m.ID_MSG, t.locked, t.numViews,t.numReplies
FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE t.ID_LAST_MSG IN (" . implode(', ', $posts) . ")
AND m.ID_MSG = t.ID_LAST_MSG
ORDER BY t.ID_LAST_MSG DESC
LIMIT " . count($posts), __FILE__, __LINE__);


Using this u can get the latest post of your Forum.

This website is proudly hosted on Crocweb Cloud Website Hosting.