Multi Prefix

Multi Prefix [Paid] 2.15.4

No permission to buy ($30.00)
the template modification can be saved without error but doesn't get applied.
This will be a useful workaround for now until I can l can look into beating the regex into shape.

I've got a couple high priority things I need to get done before Christmas and then I'll be offline between Christmas and New Years.
 
I'm encountering this error:

ErrorException: [E_WARNING] Declaration of SV\MultiPrefix\XF\Pub\Controller\Forum::applyForumFilters(XF\Entity\Forum $forum, XF\Finder\Thread $threadFinder, array $filters) should be compatible with XF\Pub\Controller\ForumController::applyForumFilters(XF\Entity\Forum $forum, XF\Finder\ThreadFinder $threadFinder, array $filters) src/addons/SV/MultiPrefix/XF/Pub/Controller/Forum.php:0

Generated by: Alfa1 Dec 27, 2024 at 6:14 PM

Stack trace
#0 src/vendor/composer/ClassLoader.php(576): XF::handlePhpError(2, '[E_WARNING] Dec...', '/home/nginx/dom...', 0, Array)
#1 src/vendor/composer/ClassLoader.php(576): include()
#2 src/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}('/home/nginx/dom...')
#3 [internal function]: Composer\Autoload\ClassLoader->loadClass('SV\\MultiPrefix\\...')
#4 src/XF.php(414): spl_autoload_call('SV\\MultiPrefix\\...')
#5 [internal function]: XF::createAliasForClass('SV\\MultiPrefix\\...')
#6 [internal function]: spl_autoload_call('SV\\MultiPrefix\\...')
#7 src/XF/Extension.php(215): class_exists('SV\\MultiPrefix\\...')
#8 src/XF/App.php(3385): XF\Extension->extendClass('XF\\Pub\\Controll...', NULL)
#9 src/XF/App.php(1854): XF\App->extendClass('XF\\Pub\\Controll...')
#10 src/XF/Container.php(233): XF\App->XF\{closure}('XF\\Pub\\Controll...', Array, Object(XF\Container))
#11 src/XF/App.php(3337): XF\Container->create('controller', 'XF:Forum', Array)
#12 src/XF/Mvc/Dispatcher.php(301): XF\App->controller('XF:Forum', Object(XF\Http\Request))
#13 src/XF/Mvc/Dispatcher.php(265): XF\Mvc\Dispatcher->dispatchClass('XF:Forum', 'index', Object(XF\Mvc\RouteMatch), NULL, Object(XF\Mvc\Reply\Reroute))
#14 src/XF/Mvc/Dispatcher.php(121): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), NULL, Object(XF\Mvc\Reply\Reroute))
#15 src/XF/Mvc/Dispatcher.php(63): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#16 src/XF/App.php(2826): XF\Mvc\Dispatcher->run()
#17 src/XF.php(806): XF\App->run()
#18 index.php(23): XF::runApp('XF\\Pub\\App')
#19 {main}

Request state

array(4) {
["url"] => string(1) "/"
["referrer"] => string(36) "..."
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}

I did encounter a similar / same issue for wordcountsearch. Does this need to have ElasticSearch Ess installed?
 
Xf2.3 and multi prefix 2.15.3
Its on a test install where I upgraded from XF1.5

The error for WordCountSearch is exactly the same.
 
Last edited:
Try rebuilding an add-on (or doing a master data rebuild) as it could be an internal caching issue. These add-ons work fine with XF2.3+
 
XF\Finder\Thread should be automatically aliased to XF\Finder\ThreadFinder in XF2.3, and there was a bunch of bugfix work in the early XF2.3 betas around that. The only thing I can think of it there is a broken cache which wasn't rebuilt in the XF1 => XF2.3 update process which should have been rebuilt.

Can you run this command to force the add-on related caches to be rebuilt?
Code:
php cmd.php xf:rebuild-master-data
 
Rebuilding master data does not resolve it. It concerns an upgrade from xf1. Are there any cleanup steps required to resolve this?
ElasticSearch Essentials is not installed. Do I need to add it?
 
Last edited:
ElasticSearch Essentials isn't needed.

I'm at a loss on why XF2.3 isn't correctly aliases the classes the add-on is using. Did you try rebuilding the MultiPrefix add-on as well?

Can you try disabling and then enabling the MultiPrefix add-on to see if that pokes the caching in the right way?
 
is there anyway to stop sorting multi prefixes alphabetical ?

on do Prefix C - Prefix A - Prefix B will sort auto to Prefix A - Prefix B - Prefix C
 
You can sort prefixes in the admincp prefix section which should apply to the prefix display order
 
1.
Is there any sense in limiting prefixes for queries?

/?prefix_id[22]=96&prefix_id[25]=88&prefix_id[32]=114&prefix_id[43]=47

could be
/?prefix_id[22]=96&prefix_id[25]=88
and we forget everything more than two prefixes?


2.
Could you add an option to forbid guests using such queries?
 
1.
Is there any sense in limiting prefixes for queries?

/?prefix_id[22]=96&prefix_id[25]=88&prefix_id[32]=114&prefix_id[43]=47

could be
/?prefix_id[22]=96&prefix_id[25]=88
and we forget everything more than two prefixes?
This isn't supported.

2.
Could you add an option to forbid guests using such queries?
I have an Thread SEO add-on which disables exposing prefix filtering and disables the 'clicky prefix' functionality for guests but I haven't finished polishing it for a public release yet as the last month has been very busy
 
Today i have many, many queries like

/page-2?prefix_id[16]=15&prefix_id[17]=36&prefix_id[21]=38&prefix_id[25]=47

in the same time you Slow Query Logger talks about 2, 3, 4 seconds to do such queries.

Now the question is: How can i prevent guests from using the prefixes?

Filters are not allowed for guests, but they can use it by direct input, links or clicking the prefixes.

I guess there should be a permission like:
can use prefixes
 
Last edited:
Idea: extend your class p/c/forum to

PHP:
        if (\XF::visitor()->user_id == 0) {
            unset($filters['prefix_id'], $filters['prefix_ids']);
        }
        else if ($this->request->exists('prefix_id'))
        {
            if ($prefixId = $this->filter('prefix_id', 'int'))
            {
                $filters['prefix_id'] = [$prefixId];
            }
            else
            {
                $filters['prefix_id'] = $this->filter('prefix_id', 'array-int');
            }
        }

or add a permission.
 
Or limit to one for guests like


Code:
if ($this->request->exists('prefix_id'))
{
    if ($prefixId = $this->filter('prefix_id', 'int'))
    {
        $filters['prefix_id'] = [$prefixId];
    }
    else
    {
        $filters['prefix_id'] = $this->filter('prefix_id', 'array-int');

        // Falls Gast, nur den ersten Prefix aus der Liste behalten
        if (\XF::visitor()->user_id == 0)
        {
            $filters['prefix_id'] = [reset($filters['prefix_id'])]; // Nur den ersten Prefix nehmen
        }
    }
}
 
Trying to install this but I'm getting an error because of Resource Manager, yet I don't have Resource Manager currently installed.
The following errors must be resolved before continuing:
  • After upgrading XenForo Resource Manager to v2.0.0+, rebuild the XFRM add-on to enable MultiPrefix support
 
Back
Top Bottom