Cupara
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:
I'm doing this in a ViewPublic file for Thread.php
Thanks
PHP:
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)
WHERE
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
Thanks