Brock
Noobie

Posts: 18

|
 |
Re:Message Sorting
« Reply #1 on: October 03, 2002, 09:36:07 PM » |
|
I'm not familiar yet with the mod system, but here's the way to make your messages display in the proper order, as well as show who made the last post/modification.
First change - the SQL Queries that retrieve the messages :
Find
$result = mysql_query("SELECT t.ID_LAST_MSG, t.ID_TOPIC, t.numReplies, t.locked, m.posterName, m.ID_MEMBER, t.numViews, m.posterTime, m.modifiedTime, t.ID_FIRST_MSG, t.isSticky, t.ID_POLL, mes.posterName as mname, mes.ID_MEMBER as mid, mes.subject as msub, mes.icon as micon FROM {$db_prefix}topics as t, {$db_prefix}messages as m, {$db_prefix}messages as mes WHERE (t.ID_BOARD=$currentboard AND m.ID_MSG=t.ID_LAST_MSG AND mes.ID_MSG=t.ID_FIRST_MSG) ORDER BY t.isSticky DESC, m.posterTime DESC LIMIT $start,$maxindex"); Replace with
$result = mysql_query("SELECT t.ID_LAST_MSG, t.ID_TOPIC, t.numReplies, t.locked, m.posterName, m.ID_MEMBER, t.numViews, m.posterTime, m.modifiedTime, t.ID_FIRST_MSG, t.isSticky, t.ID_POLL, mes.posterName as mname, mes.ID_MEMBER as mid, mes.subject as msub, mes.icon as micon, m.modifiedName FROM {$db_prefix}topics as t, {$db_prefix}messages as m, {$db_prefix}messages as mes WHERE (t.ID_BOARD=$currentboard AND m.ID_MSG=t.ID_LAST_MSG AND mes.ID_MSG=t.ID_FIRST_MSG) ORDER BY t.isSticky DESC, IFNULL(m.modifiedTime, m.posterTime) DESC LIMIT $start,$maxindex"); Find
$result = mysql_query("SELECT t.ID_LAST_MSG, t.ID_TOPIC, t.numReplies, t.locked, m.posterName, m.ID_MEMBER, t.numViews, m.posterTime, m.modifiedTime, t.ID_FIRST_MSG, t.isSticky, t.ID_POLL, mes.posterName as mname, mes.ID_MEMBER as mid, mes.subject as msub, mes.icon as micon FROM {$db_prefix}topics as t, {$db_prefix}messages as m,{$db_prefix}messages as mes WHERE (t.ID_BOARD=$currentboard AND m.ID_MSG=t.ID_LAST_MSG AND mes.ID_MSG=t.ID_FIRST_MSG) ORDER BY m.posterTime DESC LIMIT $start,$maxindex"); Replace with
$result = mysql_query("SELECT t.ID_LAST_MSG, t.ID_TOPIC, t.numReplies, t.locked, m.posterName, m.ID_MEMBER, t.numViews, m.posterTime, m.modifiedTime, t.ID_FIRST_MSG, t.isSticky, t.ID_POLL, mes.posterName as mname, mes.ID_MEMBER as mid, mes.subject as msub, mes.icon as micon, m.modifiedName FROM {$db_prefix}topics as t, {$db_prefix}messages as m,{$db_prefix}messages as mes WHERE (t.ID_BOARD=$currentboard AND m.ID_MSG=t.ID_LAST_MSG AND mes.ID_MSG=t.ID_FIRST_MSG) ORDER BY IFNULL(m.modifiedTime,m.posterTime) DESC, m.posterTime DESC LIMIT $start,$maxindex"); Second change - the displayed values for the last posting to the thread/topic.
After This
$isSticky = $row['isSticky']; $pollID = $row['ID_POLL']; $topicEditedTime = $row['posterTime']; Add This
// Grab correct poster info, based on timestamps // Last person who modified, vs last poster if($row['modifiedTime']) { $mdate = $row['modifiedTime']; $topicEditedTime = $row['modifiedTime']; $lastposter = $row['modifiedName'];
// Grab last poster ID $lresult = mysql_query("SELECT ID_MEMBER from yabbse_members where memberName=\"$lastposter\""); $lastPosterID = mysql_result($lresult,0); mysql_free_result($lresult); } I'm currently working on the same mod for the BoardIndex, I'll post it here when I finish it.
Brock
|