AndyB
Well-known member
Thank you once again for your help, Jake.
I'm making progress. Here's what I have now.
I'm making progress. Here's what I have now.
PHP:
<?php
class Andy_StickyAllPages_ControllerPublic_Forum extends XFCP_Andy_StickyAllPages_ControllerPublic_Forum
{
public function actionForum()
{
// get parent
$parent = parent::actionForum();
// if page is greater than 1
if ($parent->params['page'] > 1)
{
// get forum
$forum = $parent->params['forum'];
// get forumId
$forumId = $forum['node_id'];
$visitor = XenForo_Visitor::getInstance();
$threadModel = $this->_getThreadModel();
$page = max(1, $this->_input->filterSingle('page', XenForo_Input::UINT));
// get threadsPerPage
$threadsPerPage = $parent->params['threadsPerPage'];
// get order
$order = $forum['default_sort_order'];
// get orderDirection
$orderDirection = $forum['default_sort_direction'];
// get displayConditions
$displayConditions = $parent->params['displayConditions'];
$fetchElements = $this->_getThreadFetchElements($forum, $displayConditions);
$threadFetchConditions = $fetchElements['conditions'];
$threadFetchOptions = $fetchElements['options'] + array(
'perPage' => $threadsPerPage,
'page' => $page,
'order' => $order,
'orderDirection' => $orderDirection
);
unset($fetchElements);
// get threads
$threads = $parent->params['threads'];
// get stickyThreads
$stickyThreadFetchOptions = $threadFetchOptions;
unset($stickyThreadFetchOptions['perPage'], $stickyThreadFetchOptions['page']);
$stickyThreadConditions = $threadFetchConditions;
unset($stickyThreadConditions['last_post_date']);
$stickyThreads = $threadModel->getStickyThreadsInForum($forumId, $stickyThreadConditions, $stickyThreadFetchOptions);
// prepare all threads for the thread list
$inlineModOptions = array();
$permissions = $visitor->getNodePermissions($forumId);
foreach ($stickyThreads AS &$thread)
{
$threadModOptions = $threadModel->addInlineModOptionToThread($thread, $forum, $permissions);
$inlineModOptions += $threadModOptions;
$thread = $threadModel->prepareThread($thread, $forum, $permissions);
}
unset($thread);
// update parent
$parent->params['stickyThreads'] = $stickyThreads;
}
// return parent
return $parent;
}
}
Last edited: