[XB] XFRM Save Filters

[XB] XFRM Save Filters [Paid] 2.0.0

No permission to buy ($5.00)

Ozzy47

Well-known member
There is a fault in:

Code:
<?php

namespace PB\XFRMSaveFilters\XFRM\ControllerPlugin;

class Overview extends XFCP_Overview
{
    public function getResourceFilterInput()
    {
        $filters = parent::getResourceFilterInput();

        $visitor = \XF::visitor();

        if ($visitor->user_id && $visitor->hasPermission('resource', 'pb_xfrmsf_canUse'))
        {
            $filterRepo = $this->getFilterDefaultRepo();

            if ($this->filter('save', 'bool') && $this->isPost())
            {
                $filterRepo->saveUserDefaultFilters($visitor, $filters);
            }

            //if (!$filters && $this->filter('saved', 'bool'))
            if (!$filters)
            {
                $filters = $filterRepo->getUserDefaultFilters($visitor);
            }
        }

        return $filters;
    }


Now it works only on overview.
But with if (!$filters) instead if (!$filters && $this->filter('saved', 'bool'))
it works also on cats.
 
The problem is probably here:

Code:
    public static function navigationSetup(\XF\Pub\App $app, array &$navigationFlat, array &$navigationTree)
    {
        $visitor = \XF::visitor();
        if ($visitor->user_id && $visitor->hasPermission('resource', 'pb_xfrmsf_canUse') && isset($navigationFlat['xfrm']) && isset($navigationTree['xfrm']))
        {
            $resourceLink = $app->router('public')->buildLink('resources', null, ['saved' => true]);
            $navigationFlat['xfrm']['href'] = $resourceLink;
            $navigationTree['xfrm']['href'] = $resourceLink;
        }
    }

fits for overview and cats
if ($visitor->user_id && $visitor->hasPermission('resource', 'pb_xfrmsf_canUse') && isset($navigationFlat['xfrm']) && isset($navigationTree['xfrm']))


fits for overview only?
$resourceLink = $app->router('public')->buildLink('resources', null, ['saved' => true]);


How we can decide, if we are in a cat or have the catId to change the $resourceLink, please?
 
Hmmm
navigationSetup
is used for every page we have, right?

but we need that only for p/c/resourceitem > actionIndex without a resoure_id
and for p/c/category > actionIndex ?

also
if (!$filters && $this->filter('saved', 'bool'))

could mean that we have some_filters (from another addon for example), but not what we have saved?
 
Back
Top Bottom