Lack of interest sort thread replies by 'most likes'


Active member
I know there have been a few posts about sorting threads by likes, but it would be useful to be able to sort thread replies by 'most likes'

There are regular thread posts on one of my forums for caption competitions.
Users are asking if there is a way to vote or show the most liked replies at the top, with a secondary sort on chronological order

Digital Doctor

Well-known member
Excellent idea !
There would be so many uses to this functionality.
I could see many uses for this at itself.

Should this be an addon or a core feature ?
Probably an addon.


Well-known member
You can use order by first post likes:

public function prepareThreadFetchOptions(array $fetchOptions)
        $selectFields = '';
        $joinTables = '';
        $orderBy = '';
        if (!empty($fetchOptions['order']))
            $orderBySecondary = '';
            switch ($fetchOptions['order'])
                case 'title':
                case 'post_date':
                case 'view_count':
                    $orderBy = 'thread.' . $fetchOptions['order'];
                case 'reply_count':
                case 'first_post_likes':
                    $orderBy = 'thread.' . $fetchOptions['order'];
                    $orderBySecondary = ', thread.last_post_date DESC';
                case 'last_post_date':
                    $orderBy = 'thread.last_post_date';