Tutorial

Reverse the order and show newest most recent comments at the top of the list.

By default the newest comments appear at the bottom of the list. This can be confusing if you have a bunch as the most recent comment could actually be missed. If you have more than 5 many members and visitors don't notice the "Show More" Link.

So if you prefer to show the most recent comment at the top of the list. This one is for you.

You can reverse the order quite easily by change one little piece of code.

Always back up the original file just in case before making any modifications.

Open:
/inc/classes/BxDolCmtsQuery.php

Find:

        $a = $this->getAll("SELECT
                $sFields
                `c`.`cmt_id`,
                `c`.`cmt_parent_id`,
                `c`.`cmt_object_id`,
                `c`.`cmt_author_id`,
                `c`.`cmt_text`,
                `c`.`cmt_rate`,
                `c`.`cmt_rate_count`,
                `c`.`cmt_replies`,
                (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`c`.`cmt_time`)) AS `cmt_secs_ago`,
                `p`.`NickName` AS `cmt_author_name`,
                `m`.`med_file` AS `cmt_author_icon`
            FROM {$this->_sTable} AS `c`
            LEFT JOIN `Profiles` AS `p` ON (`p`.`ID` = `c`.`cmt_author_id`)
            LEFT JOIN `media` AS `m` ON (`m`.`med_id` = `p`.`PrimPhoto` AND `m`.`med_status` = 'active')
            $sJoin
            WHERE `c`.`cmt_object_id` = '$iId' AND `c`.`cmt_parent_id` = '$iCmtParentId'
            ORDER BY `c`.`cmt_time` ASC");


Change:
            ORDER BY `c`.`cmt_time` ASC");

To:
            ORDER BY `c`.`cmt_time` DESC");



Like So:

        $a = $this->getAll("SELECT
                $sFields
                `c`.`cmt_id`,
                `c`.`cmt_parent_id`,
                `c`.`cmt_object_id`,
                `c`.`cmt_author_id`,
                `c`.`cmt_text`,
                `c`.`cmt_rate`,
                `c`.`cmt_rate_count`,
                `c`.`cmt_replies`,
                (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`c`.`cmt_time`)) AS `cmt_secs_ago`,
                `p`.`NickName` AS `cmt_author_name`,
                `m`.`med_file` AS `cmt_author_icon`
            FROM {$this->_sTable} AS `c`
            LEFT JOIN `Profiles` AS `p` ON (`p`.`ID` = `c`.`cmt_author_id`)
            LEFT JOIN `media` AS `m` ON (`m`.`med_id` = `p`.`PrimPhoto` AND `m`.`med_status` = 'active')
            $sJoin
            WHERE `c`.`cmt_object_id` = '$iId' AND `c`.`cmt_parent_id` = '$iCmtParentId'
            ORDER BY `c`.`cmt_time` DESC");


Save file, and re-upload overwriting the original.

Simply refresh a page with comments to see the changes.

If you don't like it simply change DESC back to ASC

This does affect all comment areas of Dolphin. Blogs, Profiles, Audio & Video, Classifieds, etc. It will not affect Orca comments/posts/replies.

 

 

Screen Shot Blog Original:

Blog Comments Before

 

Screen Shot Blog After:

Blog Comments After

 

Screen Shot Profile Original:

Profile Comments Before

 

Screen Shot Profile After:

Profile Comments After

 
Written By
Tutorial by: Jeremy LeSarge (AKA Ray)

I am the owner and administrator of DialMe.com. I write Tutorials for Boonex Dolphin as well as tips and resources surrounding website programming and development. I enjoy working with WordPress, SEO, and Web Hosting / Servers. I also maintain a WordPress Blog here on this site where you will find a variety of technology and webmaster resources.

Actions
Recommend
Sponsored Links