Fixed Search loses grouping in URL when change user

Jon W

Well-known member
If a user shares a search link that includes grouping (i.e., group discussions as threads), when a different user then follows they link, they get a link that doesn't include the grouping. Even though this doesn't affect the results immediately, if they then shared this link, the grouping would be lost.

For example:
http://xenforo.com/community/search/5355539/?q=grouping&t=post&o=relevance&g=1

Notice that the &g=1 disappears.

The problem is because the $existingSearch variable is used in XenForo_ControllerPublic_Search:
PHP:
        return $searchModel->insertSearch(
            $results, $search['search_type'], $search['search_query'], $constraints,
            $search['search_order'], $existingSearch['search_grouping'], $userResults,
            $searcher->getWarnings(), $visitorUserId
        );

This variable is always false. The correct code is:
PHP:
        return $searchModel->insertSearch(
            $results, $search['search_type'], $search['search_query'], $constraints,
            $search['search_order'], $search['search_grouping'], $userResults,
            $searcher->getWarnings(), $visitorUserId
        );
 
Top Bottom