That method is really designed for an explicit filter system, like what you see on forum view, so it's used in conjunction with
getPostListFilterInput
. The code takes different paths depending on whether filters are present. As an example:
Code:
if ($effectiveOrder == 'post_date' && !$filters)
{
// can only do this if sorting by position
$postList->onPage($page, $perPage);
}
else
{
$postList->limitByPage($page, $perPage);
}
$totalPosts = $filters ? $postList->total() : ($thread->reply_count + 1);
You might now think "ok, I'll just return a filter from getPostListFilterInput in all cases and that'll work". And you'd be somewhat right, but there are other cases that may still fall over. Notably, things like the page-specific links on thread list items (forum view); you'll have at least one situation where they will say there's a page X but with the automatic filter, there's only X-1. That would probably get sorted by an automatic redirect, so that might not be a huge deal. However, all of the code that jumps to a specific relies on determining the page based on the post's position, and that won't necessarily be correct for anything after the pulled-out post. You could potentially override
XF\ControllerPlugin\Thread::getPostLink
for your case, though this doesn't necessarily override some of the more UI-based issues with how it affects "go to unread"...
Of course, the other caveat of always applying a filter is that it ends up violating other assumptions, like how we can trigger read marking, since that's based on saving the date of the last read post. And if there's a filter, we can't know if there are posts that aren't being shown, so we simply can't trigger the read marking system.