1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Lack of Interest sort thread replies by 'most likes'

Discussion in 'Closed Suggestions' started by gib, Nov 3, 2011.

  1. gib

    gib 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
    GeeksChat and Digital Doctor like this.
  2. Digital Doctor

    Digital Doctor Well-Known Member

    Excellent idea !
    There would be so many uses to this functionality.
    I could see many uses for this at xenforo.com itself.

    Should this be an addon or a core feature ?
    Probably an addon.
    darenet likes this.
  3. Fuhrmann

    Fuhrmann 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';

Share This Page