[TH] Admin Tools [Deleted]

Matt C.

Well-known member
Okay all the server errors have different request states. Here are a few.

Code:
array(4) {
  ["url"] => string(87) "/misc/style?_xfRedirect=%2F&style_id=26&t=1521724210%2C747132460a330a3eb3aea018f5cc4c1a"
  ["referrer"] => bool(false)
  ["_GET"] => array(3) {
    ["_xfRedirect"] => string(1) "/"
    ["style_id"] => string(2) "26"
    ["t"] => string(43) "1521724210,747132460a330a3eb3aea018f5cc4c1a"
  }
  ["_POST"] => array(0) {
  }
}

Code:
array(4) {
  ["url"] => string(102) "/misc/style?redirect=%2Fmisc%2Fstyle%3Fredirect%3D%252Farticles%252Fe3-2017-vertical-slice-why.16%252F"
  ["referrer"] => bool(false)
  ["_GET"] => array(1) {
    ["redirect"] => string(67) "/misc/style?redirect=%2Farticles%2Fe3-2017-vertical-slice-why.16%2F"
  }
  ["_POST"] => array(0) {
  }
}

Code:
array(4) {
  ["url"] => string(75) "/misc/style?redirect=%2Fxengallery%2Falbums%2Fanthem-e3-trailer-images.4%2F"
  ["referrer"] => bool(false)
  ["_GET"] => array(1) {
    ["redirect"] => string(46) "/xengallery/albums/anthem-e3-trailer-images.4/"
  }
  ["_POST"] => array(0) {
  }
}

Code:
array(4) {
  ["url"] => string(72) "/misc/style?redirect=%2Fmisc%2Fquick-navigation-menu%3Fselected%3Dnode-9"
  ["referrer"] => bool(false)
  ["_GET"] => array(1) {
    ["redirect"] => string(43) "/misc/quick-navigation-menu?selected=node-9"
  }
  ["_POST"] => array(0) {
  }
}

Code:
array(4) {
  ["url"] => string(125) "/misc/style?redirect=https%3A%2F%2Fanthemhub.net%2Fxengallery%2Fusers%2Fcarlo.26%2F%3Fcontainer%3Dsite%26page%3D2&style_id=10"
  ["referrer"] => bool(false)
  ["_GET"] => array(2) {
    ["redirect"] => string(70) "https://anthemhub.net/xengallery/users/carlo.26/?container=site&page=2"
    ["style_id"] => string(2) "10"
  }
  ["_POST"] => array(0) {
  }
}
 

Lukas W.

Well-known member
Can you replace the content of src/adons/KL/AdminTools/Pub/Controller/Misc.php with the following to see if it fixes the problem?
PHP:
<?php

namespace KL\AdminTools\Pub\Controller;

use XF\Mvc\Reply\View;

class Misc extends XFCP_Misc {
    public function actionStyle()
    {
        $styleReply = parent::actionStyle();

        if($styleReply instanceof View) {
            if(!empty($styleReply->getTemplateName()) &&  $styleReply->getTemplateName() == 'style_chooser') {
                $styles = $styleReply->getParam('styles');

                usort($styles, function ($a, $b) {
                    return $a['display_order'] >= $b['display_order'];
                });

                $styleReply->setParam('styles', $styles);
            }
        }

        return $styleReply;
    }
}
 

Matt C.

Well-known member
Can you replace the content of src/adons/KL/AdminTools/Pub/Controller/Misc.php with the following to see if it fixes the problem?
PHP:
<?php

namespace KL\AdminTools\Pub\Controller;

use XF\Mvc\Reply\View;

class Misc extends XFCP_Misc {
    public function actionStyle()
    {
        $styleReply = parent::actionStyle();

        if($styleReply instanceof View) {
            if(!empty($styleReply->getTemplateName()) &&  $styleReply->getTemplateName() == 'style_chooser') {
                $styles = $styleReply->getParam('styles');

                usort($styles, function ($a, $b) {
                    return $a['display_order'] >= $b['display_order'];
                });

                $styleReply->setParam('styles', $styles);
            }
        }

        return $styleReply;
    }
}

That did it! I'm not getting any more errors. Thank you!
 

Lukas W.

Well-known member
That did it! I'm not getting any more errors. Thank you!
You'll probably receive a file health check error every once in a while now, because you've modified the file. It's safe to ignore that and will go away with the next update.
 

Tealk

Well-known member
Have get this error:
Code:
    ErrorException: Template error: Invalid argument supplied for foreach() src/XF/Repository/Attachment.php:168

    Generated by: Unknown account Apr 14, 2018 at 5:12 PM

Stack trace

#0 src/XF/Repository/Attachment.php(168): XF\Template\Templater->handleTemplateError(2, 'Invalid argumen...', '/var/www/anzahc...', 168, Array)
#1 src/XF/NewsFeed/AbstractHandler.php(95): XF\Repository\Attachment->addAttachmentsToContent(NULL, 'post', 'attach_count', 'Attachments')
#2 src/XF/NewsFeed/Post.php(30): XF\NewsFeed\AbstractHandler->addAttachments(NULL)
#3 src/XF/NewsFeed/AbstractHandler.php(78): XF\NewsFeed\Post->addAttachmentsToContent(NULL)
#4 src/XF/Entity/NewsFeed.php(53): XF\NewsFeed\AbstractHandler->getContent(9072)
#5 src/XF/Mvc/Entity/Entity.php(142): XF\Entity\NewsFeed->getContent()
#6 src/XF/Mvc/Entity/Entity.php(95): XF\Mvc\Entity\Entity->get('Content')
#7 src/XF/NewsFeed/AbstractHandler.php(56): XF\Mvc\Entity\Entity->__get('Content')
#8 src/XF/Entity/NewsFeed.php(64): XF\NewsFeed\AbstractHandler->render(Object(XF\Entity\NewsFeed))
#9 [internal function]: XF\Entity\NewsFeed->render()
#10 src/XF/Template/Templater.php(938): call_user_func_array(Array, Array)
#11 internal_data/code_cache/templates/l3/s0/admin/kl_at_privacy_report_activity.php(14): XF\Template\Templater->method(Object(XF\Entity\NewsFeed), 'render', Array)
#12 src/XF/Template/Templater.php(1248): XF\Template\Templater->{closure}(Object(ThemeHouse\UIX\XF\Template\Templater), Array)
#13 src/addons/KL/AdminTools/Service/PrivacyReport.php(453): XF\Template\Templater->renderTemplate('kl_at_privacy_r...', Array)
#14 src/addons/KL/AdminTools/Service/PrivacyReport.php(332): KL\AdminTools\Service\PrivacyReport->renderTemplate('kl_at_privacy_r...', 1, 'activity', Array)
#15 src/XF/MultiPartRunnerTrait.php(48): KL\AdminTools\Service\PrivacyReport->stepBuildActivityLog(NULL, 7.9361610412598)
#16 src/addons/KL/AdminTools/Service/PrivacyReport.php(187): KL\AdminTools\Service\PrivacyReport->runLoop(8)
#17 src/addons/KL/AdminTools/Job/PrivacyReport.php(56): KL\AdminTools\Service\PrivacyReport->build(8)
#18 src/XF/Job/Manager.php(241): KL\AdminTools\Job\PrivacyReport->run(8)
#19 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 8)
#20 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 8)
#21 job.php(15): XF\Job\Manager->runQueue(false, 8)
#22 {main}

Request state

array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 

Filetrip

Active member
this addon looks amazing and I would love to use it.
I am on Xenforo 1.5 though, is there a version of the addon for 1.5 users? I did not see one :(
 

MegaPixel

Member
Not sure if it'd be considered for this addon, but would love to see 'autotools' as an option which would help simplify work for forums.

Such as options on certain nodes/threads to do multiple steps at once, for example:

AutoTool button for a member which would change that members permissions and send them a private message at the same time.

Or example for a thread:

Accept an application > Posts a reply, moves it somewhere else and closes it.

Just little features like that would make jobs be able to be completed a little easier. If possible. ^^
 

Maik

Member
Nice addon.
I am looking for the ability to mass rename or anonymize users, because I have to delte over 3000 users in my forum.
It would be nice if you can add this option.
 

imno007

Well-known member
Nice addon.
I am looking for the ability to mass rename or anonymize users, because I have to delte over 3000 users in my forum.
It would be nice if you can add this option.
Do you want to give all your users the same name, or give all members of a group the same name? Just wondering, because if not wouldn't you still have to rename them one by one...?
 

Maik

Member
I am looking for an option to rename users to "Guest 1234" where the number is the userid.
I want to rename over 3000 useres that way to make the names anonym and then delete these useres.
I know that xenforo has this option, but only for one user.
 

anon666

Active member
I would like to suggest a tool to completely remove a user, along with their posts, profile messages, private conversations, and everything about their privacy.
 

Tealk

Well-known member
Can you replace the content of src/adons/KL/AdminTools/Pub/Controller/Misc.php with the following to see if it fixes the problem?
PHP:
<?php

namespace KL\AdminTools\Pub\Controller;

use XF\Mvc\Reply\View;

class Misc extends XFCP_Misc {
    public function actionStyle()
    {
        $styleReply = parent::actionStyle();

        if($styleReply instanceof View) {
            if(!empty($styleReply->getTemplateName()) &&  $styleReply->getTemplateName() == 'style_chooser') {
                $styles = $styleReply->getParam('styles');

                usort($styles, function ($a, $b) {
                    return $a['display_order'] >= $b['display_order'];
                });

                $styleReply->setParam('styles', $styles);
            }
        }

        return $styleReply;
    }
}
could there be an update soon? my system causes errors in the file health check
 

Finexes

Well-known member
This is a really great addon, thanks for this! However, I know it's unsupported, but I'm getting spammed with these errors on XF 2.1:

Code:
ErrorException: [E_WARNING] usort() expects parameter 1 to be array, null given src/addons/KL/AdminTools/Pub/Controller/Misc.php:27
    
#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] uso...', '/var/www/vhosts...', 27, Array)
#1 src/addons/KL/AdminTools/Pub/Controller/Misc.php(27): usort(NULL, Object(Closure))
#2 src/XF/Mvc/Dispatcher.php(321): KL\AdminTools\Pub\Controller\Misc->actionStyle(Object(XF\Mvc\ParameterBag))
#3 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XF:Misc', 'Style', Object(XF\Mvc\RouteMatch), Object(KL\AdminTools\Pub\Controller\Misc), NULL)
#4 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(KL\AdminTools\Pub\Controller\Misc), NULL)
#5 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#6 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#7 src/XF.php(390): XF\App->run()
#8 index.php(20): XF::runApp('XF\\Pub\\App')
#9 {main}
 

imno007

Well-known member
Crappo. Is this the one I'm using to order styles in the order I want on the chooser? Have to find a replacement for this one, too, if so. 🤪
 

ThemeHouse

Well-known member
Big and exciting changes are coming as we adjust our trajectory, just know that we’ll be with you every step of the way. Take a look at our announcement here for more information. If you have any questions, please contact us here so we can assist.
 
Top