Welcome, Guest. Please Login or Register.
May 06, 2025, 05:39:05 AM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Message Sorting « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Message Sorting  (Read 320 times)
Brock
Noobie
*
Posts: 18


Message Sorting
« on: September 17, 2002, 05:00:55 PM »
Reply with quote

This might be a mod candidate, I'm not sure how this was intended to work, so feel free to blast this topic to the appropriate forum if this is the wrong place.

When looking at new topics, they are sorting based solely upon the date/time that the last reply was placed into the thread. Modifications to a post (ie edits) will trigger a new flag, but will not alter the posts placement in the list.

Logged
Brock
Noobie
*
Posts: 18


Re:Message Sorting
« Reply #1 on: October 03, 2002, 09:36:07 PM »
Reply with quote

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
« Last Edit: October 03, 2002, 09:36:49 PM by Brock » Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Message Sorting « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.357 seconds with 21 queries.