arms
Well-known member
I'm trying to filter my thread list by tags.
If i filter by tag 4 (i know there is 4 entries in that forum category), I get the correct number of threads but it doesn't update the pagination(still showing 1 to 4 of 24 threads)
Anyone know how i refresh the pagination to show correctly.
If i filter by tag 4 (i know there is 4 entries in that forum category), I get the correct number of threads but it doesn't update the pagination(still showing 1 to 4 of 24 threads)
Anyone know how i refresh the pagination to show correctly.
PHP:
<?php
class PG_Filter_XenForo_Model_Thread extends XFCP_PG_Filter_XenForo_Model_Thread
{
/**
*
* @see XenForo_Model_Thread::prepareThreadFetchOptions()
*/
public function prepareThreadFetchOptions(array $fetchOptions)
{
$threadFetchOptions = parent::prepareThreadFetchOptions($fetchOptions);
$joinTables = $threadFetchOptions['joinTables'];
if (isset($fetchOptions['ThreadTagId'])) {
if (!empty($fetchOptions['ThreadTagId'])) {
$joinTables .= '
INNER JOIN xf_tinhte_xentag_tagged_content AS xentag_tagged_content
ON (xentag_tagged_content.content_id = thread.thread_id
AND xentag_tagged_content.tag_id IN ( ' .
$this->_getDb()->quote($fetchOptions['ThreadTagId']) . '))';
}
}
return array(
'selectFields' => $threadFetchOptions['selectFields'],
'joinTables' => $joinTables,
'orderClause' => $threadFetchOptions['orderClause']
);
}
PHP:
PHP:
<?php
class PG_Filter_XenForo_ControllerPublic_Forum extends XFCP_PG_Filter_XenForo_ControllerPublic_Forum
{
public function actionForum()
{
$response = parent::actionForum();
if (isset($response->params['pageNavParams']['ThreadTagId'])) {
$response->params['ThreadTagId'] = $response->params['pageNavParams']['ThreadTagId'];
//unset($response->params['pageNavParams']['ThreadTagId']);
}
return $response;
} /* END actionForum */
/**
*
* @see XenForo_ControllerPublic_Forum::_getThreadFetchElements()
*/
protected function _getThreadFetchElements(array $forum, array $displayConditions)
{
$fetchElements = parent::_getThreadFetchElements($forum, $displayConditions);
if (isset($displayConditions['ThreadTagId'])) {
$fetchElements['options']['ThreadTagId'] = $displayConditions['ThreadTagId'];
}
return $fetchElements;
} /* END _getThreadFetchElements */
/**
*
* @see XenForo_ControllerPublic_Forum::_getDisplayConditions()
*/
protected function _getDisplayConditions(array $forum)
{
$displayConditions = parent::_getDisplayConditions($forum);
$mytags = $this->_input->filterSingle('tag_id', XenForo_Input::STRING);
if ($mytags) {
$displayConditions['ThreadTagId'] = $mytags;
}
return $displayConditions;
}
Last edited: