Likes for current page


Well-known member
I'm trying to pull the likes for the current page of a thread that a user is currently viewing. The code I have so far is this:

    private function getPagePosts()
        $db = XenForo_Application::getDb();
        $options = XenForo_Application::get('options');
        return $db->fetchAll("
            SELECT *
            FROM xf_post AS post
            LEFT JOIN xf_user AS user ON (user.user_id = post.user_id)
                post.thread_id = ? AND
                post.likes > 0
            ORDER BY
                post.post_date DESC
            ", array( $this->_params['thread']['thread_id'] ));
I'm doing this in a ViewPublic file for Thread.php



Well-known member
Attempting to use:
Returns an array, so put it in an array() it comes back with an error: An exception occurred: Mysqli prepare error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 5 OFFSET 1'

So not sure where to go now.


Well-known member
Ok so I have it working, the problem now is that it displays results for page-2 instead of the current page. How do I get this to work with showing me current page results only?