Thread Tagging Improvements

Thread Tagging Improvements 1.0.8 Patch Level 1

No permission to download
please hel
ErrorException: [E_WARNING] count(): Parameter must be an array or an object that implements Countable in src/addons/MaZ/PotentialTagHelper/Job/TagThreads.php at line 65
  1. XF::handlePhpError()
  2. count() in src/addons/MaZ/PotentialTagHelper/Job/TagThreads.php at line 65
  3. MaZ\PotentialTagHelper\Job\TagThreads->getStatusMessage() in src/XF/Admin/Controller/Tools.php at line 176
  4. XF\Admin\Controller\Tools->actionRunJob() in src/XF/Mvc/Dispatcher.php at line 352
  5. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 259
  6. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 115
  7. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
  8. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2485
  9. XF\App->run() in src/XF.php at line 524
  10. XF::runApp() in admin.php at line 13
 
a little bit so beautiful that it should be the default on XF! Where can I put it to work on some form?
 
1 there s an issue with ignored potential tags page
Code:
tags/ignored-potential
pagination on it has wrong url
istead of
Code:
tags/ignored-potential/&order=use_count&page=2
it has
Code:
tags/potential/&order=use_count&page=2


2 when using group selection and action on potential tags page - after action (ignore / unignore ) always redirected to 1st page (but if im using a button for single action it doesn't happen)

3 when using sorting other than default option - and after making group action im redirected to 1st page of the default sorting (but if im using a button for single action it doesn't happen)
 
Last edited:
And still explore potential and sorting is broken (url is doubled) im using 2.2 ver
This is a very good and useful addon, but the fact that obvious problems are not fixed for a long time is puzzling.
 
Auto-suggesting tags when posting a thread (From the thread title)

Could this option also be added from the first post text? (title + first post text).

I wouldn't mind making a donation to have this feature... The addon is fantastic!!
 
Also happened when rebuilding tag cashes. Excluding some forums prevented this. Maybe to large posts in some threads?

Code:
XF\Db\Exception: MySQL query error [1406]: Data too long for column 'execute_data' at row 1 src/XF/Db/AbstractStatement.php:230
Generated by: bodybuilding.nl Sep 30, 2024 at 1:32 AM

Stack trace
UPDATE  [ICODE]xf_job[/ICODE] SET [ICODE]execute_data[/ICODE] = ?, [ICODE]trigger_date[/ICODE] = ?, [ICODE]last_run_date[/ICODE] = ? WHERE job_id = ?
------------

#0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL query err...', 1406, '22001')
#1 src/XF/Db/Mysqli/Statement.php(79): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1406, '22001')
#2 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(324): XF\Db\AbstractAdapter->query('UPDATE  `xf_job...', Array)
#4 src/XF/Job/Manager.php(225): XF\Db\AbstractAdapter->update('xf_job', Array, 'job_id = ?', 1432045)
#5 src/XF/Job/Manager.php(118): XF\Job\Manager->runJobEntry(Array, 8)
#6 src/XF/Admin/Controller/Tools.php(122): XF\Job\Manager->runByIds(Array, 8)
#7 src/XF/Mvc/Dispatcher.php(352): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#8 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', Object(XF\Mvc\RouteMatch), Object(SV\UserMentionsImprovements\XF\Admin\Controller\Tools), NULL)
#9 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(SV\UserMentionsImprovements\XF\Admin\Controller\Tools), NULL)
#10 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#11 src/XF/App.php(2485): XF\Mvc\Dispatcher->run()
#12 src/XF.php(524): XF\App->run()
#13 admin.php(13): XF::runApp('XF\\Admin\\App')
#14 {main}

Request state
array(4) {
  ["url"] => string(24) "/admin.php?tools/run-job"
  ["referrer"] => string(53) "/admin.php?tools/run-job"
  ["_GET"] => array(1) {
    ["tools/run-job"] => string(0) ""
  }
  ["_POST"] => array(3) {
    ["_xfRedirect"] => string(90) "/admin.php?add-ons/install-from-archive-complete&batch_id=423"
    ["_xfToken"] => string(8) "********"
    ["only_ids"] => string(15) "1432045,1432046"
  }
}
 
Last edited:
"Explore words"
Code:
An exception occurred: [ErrorException] [E_DEPRECATED] mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in src/addons/MaZ/PotentialTagHelper/Listener.php on line 33

[LIST=1]
[*]XF::handlePhpError()
[*]mb_convert_encoding() in src/addons/MaZ/PotentialTagHelper/Listener.php at line 33
[*]MaZ\PotentialTagHelper\Listener::addBreadCrumbNode()
[*]preg_replace_callback() in src/addons/MaZ/PotentialTagHelper/Listener.php at line 24
[*]MaZ\PotentialTagHelper\Listener::app_admin_complete() in src/XF/Extension.php at line 86
[*]XF\Extension->fire() in src/XF/App.php at line 3368
[*]XF\App->fire() in src/XF/Admin/App.php at line 123
[*]XF\Admin\App->complete() in src/XF/App.php at line 2829
[*]XF\App->run() in src/XF.php at line 806
[*]XF::runApp() in admin.php at line 15
[/LIST]
 
XF 2.2.16

Code:
TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given src/addons/MaZ/PotentialTagHelper/Job/TagThreads.php:65

Stack trace
#0 src/addons/MaZ/PotentialTagHelper/Job/TagThreads.php(65): count('auto')
#1 src/XF/Admin/Controller/Tools.php(176): MaZ\PotentialTagHelper\Job\TagThreads->getStatusMessage()
#2 src/XF/Mvc/Dispatcher.php(352): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#3 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', Object(XF\Mvc\RouteMatch), Object(SV\UserMentionsImprovements\XF\Admin\Controller\Tools), NULL)
#4 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(SV\UserMentionsImprovements\XF\Admin\Controller\Tools), NULL)
#5 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#6 src/XF/App.php(2485): XF\Mvc\Dispatcher->run()
#7 src/XF.php(524): XF\App->run()
#8 admin.php(13): XF::runApp('XF\\Admin\\App')
#9 {main}

Request state
array(4) {
  ["url"] => string(24) "/admin.php?tools/run-job"
  ["referrer"] => string(39) "/admin.php"
  ["_GET"] => array(1) {
    ["tools/run-job"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}

Code:
ErrorException: [E_WARNING] Attempt to read property "tag_id" on null src/addons/MaZ/PotentialTagHelper/Repository/PotentialTags.php:180

Stack trace
#0 src/addons/MaZ/PotentialTagHelper/Repository/PotentialTags.php(180): XF::handlePhpError(2, '[E_WARNING] Att...', '/home/bodyforum...', 180)
#1 src/addons/MaZ/PotentialTagHelper/Job/TagThreads.php(38): MaZ\PotentialTagHelper\Repository\PotentialTags->potentialThreadIdsForTag(NULL, true)
#2 src/XF/Job/Manager.php(260): MaZ\PotentialTagHelper\Job\TagThreads->run(8)
#3 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 8)
#4 src/XF/Job/Manager.php(118): XF\Job\Manager->runJobEntry(Array, 8)
#5 src/XF/Admin/Controller/Tools.php(122): XF\Job\Manager->runByIds(Array, 8)
#6 src/XF/Mvc/Dispatcher.php(352): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#7 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', Object(XF\Mvc\RouteMatch), Object(SV\UserMentionsImprovements\XF\Admin\Controller\Tools), NULL)
#8 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(SV\UserMentionsImprovements\XF\Admin\Controller\Tools), NULL)
#9 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#10 src/XF/App.php(2485): XF\Mvc\Dispatcher->run()
#11 src/XF.php(524): XF\App->run()
#12 admin.php(13): XF::runApp('XF\\Admin\\App')
#13 {main}

Request state
array(4) {
  ["url"] => string(24) "/admin.php?tools/run-job"
  ["referrer"] => string(53) "/admin.php?tags/&page=13"
  ["_GET"] => array(1) {
    ["tools/run-job"] => string(0) ""
  }
  ["_POST"] => array(5) {
    ["only_id"] => string(7) "1453768"
    ["_xfRequestUri"] => string(24) "/admin.php?tags/&page=13"
    ["_xfWithData"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfResponseType"] => string(4) "json"
  }
}
 
Last edited:
Hello everyone,
I get the following error message when I insert tags into a post. can anyone help me? Thanks a lot

Code:
XF\Db\Exception: MySQL query error [1364]: Field 'pth_is_loner' doesn't have a default value in src/XF/Db/AbstractStatement.php at line 217
XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 196
XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 78
XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 94
XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 222
XF\Db\AbstractAdapter->insert() in src/XF/Mvc/Entity/Entity.php at line 1452
XF\Mvc\Entity\Entity->_saveToSource() in src/XF/Mvc/Entity/Entity.php at line 1184
XF\Mvc\Entity\Entity->save() in src/XF/Repository/Tag.php at line 144
XF\Repository\Tag->createTag() in src/XF/Service/Tag/Changer.php at line 307
XF\Service\Tag\Changer->save() in src/XF/Pub/Controller/Thread.php at line 1143
XF\Pub\Controller\Thread->actionTags() in src/XF/Mvc/Dispatcher.php at line 321
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 249
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 100
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2178
XF\App->run() in src/XF.php at line 390
XF::runApp() in index.php at line 20
 
At ACP options - /admin.php?tags/potential and /admin.php?tags/ - using filtering ( 'Word contains ...' ) at the top, the target URL generated is broken ....

https://<site.com>/admin.php?//<site.com>/admin.php?tags/potential&containing=test&order=use_count&page=1
The problem occurs because the call to $this->request->getFullRequestUri() returns a full URL, which is then included again in buildLink, resulting in a malformed URL.

I solved this a while ago by editing /src/addons/MaZ/PotentialTagHelper/XF/Admin/Controller/Tag.php in the function:
PHP:
    public function actionIndex(ParameterBag $params)
    {
        if (\XF::options()->pth_manage_tags_redir_post_to_get && $this->isPost()) {
            // Allows xfRedirect to return correctly when editing/merging/deleting tags..
            $input = $this->filter(['containing' => 'str', 'order' => 'str']);
            return $this->redirect($this->buildLink($this->request->getFullRequestUri(), null, $input));
        }
        $result = parent::actionIndex($params);
        $containing = $this->filter('containing', 'str');
        if ($containing) {
            $finder = \XF::finder('XF:Tag');
            $synonym_tags = \XF::finder('XF:Tag')
                ->where('pth_synonyms', 'like', $finder->escapeLike($containing, '%?%'))
                ->fetch();
            $tags = $result->getParam('tags');
            $tags = $tags->merge($synonym_tags);
            $result->setParam('tags', $tags);
        }
        return $result;
    }

I replaced it with this one:
PHP:
    public function actionIndex(ParameterBag $params)
    {
        if (\XF::options()->pth_manage_tags_redir_post_to_get && $this->isPost()) {
            // Retrieves the necessary parameters from the request
            $input = $this->filter(['containing' => 'str', 'order' => 'str']);

            // Constructs a relative URL instead of using the full URL
            $redirectUrl = $this->buildLink('tags', null, $input);

            return $this->redirect($redirectUrl);
        }

        $result = parent::actionIndex($params);

        $containing = $this->filter('containing', 'str');
        if ($containing) {
            $finder = \XF::finder('XF:Tag');
            $synonym_tags = $finder
                ->where('pth_synonyms', 'like', $finder->escapeLike($containing, '%?%'))
                ->fetch();
            $tags = $result->getParam('tags');
            $tags = $tags->merge($synonym_tags);
            $result->setParam('tags', $tags);
        }

        return $result;
    }

This ensures that the redirection avoids including the full URL again, preventing malformed URLs.

And truth be told, I haven’t had a single issue since I made this change, and it’s been quite a while. That said, I haven’t upgraded to 2.3, I’m still using 2.2.15 with the security patches that have been released, patching whatever I can on my own. I have too many internal modifications to mess with something that’s already working. Hopefully, this will be helpful to someone. ;)
 
Back
Top Bottom