Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Normal
Under some conditions, we need to add further relations when loading threads for a search forum (to avoid n additional queries).This could be accomplished by passing $extraWith to \XF\Entity\SearchForumUserCache::getThreadsByPage(), but unfortunately this method is called rather in the middle of \XF\Pub\Controller\SearchForum::actionView() with no obviois option to set this parameter.[php]$threads = $userCache->getThreadsByPage($page, $perPage);[/php]So short of completely overwriting the action method (or using some rather ugly hack like setting a pseudo-global to change the bevaviour of \XF\Entity\SearchForumUserCache::getThreadsByPage(), calling parent and resetting the pseudo-global aferwards) I don't see a sane way to achive this.Could this call be moved to its own method (similar to \XF:\Pub\Controller\Forum::applyForumFilters(), also passing $searchForum as a param) within the controller? This would allow to easily modify the behaviour.
Under some conditions, we need to add further relations when loading threads for a search forum (to avoid n additional queries).
This could be accomplished by passing $extraWith to \XF\Entity\SearchForumUserCache::getThreadsByPage(), but unfortunately this method is called rather in the middle of \XF\Pub\Controller\SearchForum::actionView() with no obviois option to set this parameter.
$extraWith
\XF\Entity\SearchForumUserCache::getThreadsByPage()
\XF\Pub\Controller\SearchForum::actionView()
[php]
$threads = $userCache->getThreadsByPage($page, $perPage);
[/php]
So short of completely overwriting the action method (or using some rather ugly hack like setting a pseudo-global to change the bevaviour of \XF\Entity\SearchForumUserCache::getThreadsByPage(), calling parent and resetting the pseudo-global aferwards) I don't see a sane way to achive this.
Could this call be moved to its own method (similar to \XF:\Pub\Controller\Forum::applyForumFilters(), also passing $searchForum as a param) within the controller? This would allow to easily modify the behaviour.
\XF:\Pub\Controller\Forum::applyForumFilters()
$searchForum
We use essential cookies to make this site work, and optional cookies to enhance your experience.
See further information and configure your preferences