XF 2.0 Need assistance with filtering

Matt C.

Well-known member
I'm trying to implement filtering in one of my add-ons. It's done for the most part but I just have one slight problem. When I hit the filter button, it doesn't redirect you to the filter URL. If I go to the filter URL (/dev-tracker/&service=twitter) manually it works fine, which you can see in the screenshot.

Screenshot (17).webp

I'm pretty sure the problem is right here:
Code:
if ($this->filter('apply', 'bool'))
{
    return $this->redirect($this->buildLink('dev-tracker', $filters));
}

It looks fine to me, but there's obviously a problem.

Here is the filter macro if you need to see that:
Code:
<xf:if is="$filters.service">
    <li><a href="{{ link($baseLinkPath, $filters|replace('service', null)) }}"
        class="filterBar-filterToggle" data-xf-init="tooltip" title="{{ phrase('remove_this_filter')|for_attr }}">
        <span class="filterBar-filterToggle-label">{{ phrase('ah_dev_tracker_service:') }}</span>
        <xf:if is="$filters.service == 'twitter'">{{ phrase('ah_dev_tracker_twitter') }}<xf:else />{{ phrase('ah_dev_tracker_reddit') }}</xf:if></a></li>
</xf:if>

Thank you, any help would be great.

Edit: The solution is
PHP:
return $this->redirect($this->buildLink('dev-tracker', null, $filters));
 
Last edited:
Top Bottom