[Andrew] Moderator Panel

[Andrew] Moderator Panel 1.9.4

No permission to download
Is it slow when viewing banned users or any other page of the moderator panel?
I did small modifications to sql queries here's my revision:
it works much faster now.
(still discouraged users panel slow cuz of COUNT query.) couldn't find a way to improve this.

 
I did small modifications to sql queries here's my revision:
it works much faster now.
(still discouraged users panel slow cuz of COUNT query.) couldn't find a way to improve this.

Thanks for doing this.

I do get this error on my local
Code:
TypeError: Return value of Andrew\ModeratorPanel\Pub\Controller\ModeratorPanel::Andrew\ModeratorPanel\Pub\Controller\{closure}() must be an instance of XF\Entity\User, null returned in src/addons/Andrew/ModeratorPanel/Pub/Controller/ModeratorPanel.php at line 54
Andrew\ModeratorPanel\Pub\Controller\ModeratorPanel->Andrew\ModeratorPanel\Pub\Controller\{closure}()
array_map() in src/addons/Andrew/ModeratorPanel/Pub/Controller/ModeratorPanel.php at line 53
Andrew\ModeratorPanel\Pub\Controller\ModeratorPanel->actionIndex() in src/XF/Mvc/Dispatcher.php at line 352
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 259
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 115
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2351
XF\App->run() in src/XF.php at line 517
XF::runApp() in index.php at line 20

Looks like it doesn't like:
PHP:
            //leftfix
            $finder = \XF::finder('XF:UserBan');
            $bannedusers_xfban = $finder
                ->with('User')
                ->order('ban_date', 'DESC')
                ->limit(10)
                ->fetch()->toArray();

            $bannedusers = array_map(function(\XF\Entity\UserBan $value): \XF\Entity\User {
                return $value->User;
            },$bannedusers_xfban);
 
Thanks for doing this.

I do get this error on my local
Code:
TypeError: Return value of Andrew\ModeratorPanel\Pub\Controller\ModeratorPanel::Andrew\ModeratorPanel\Pub\Controller\{closure}() must be an instance of XF\Entity\User, null returned in src/addons/Andrew/ModeratorPanel/Pub/Controller/ModeratorPanel.php at line 54
Andrew\ModeratorPanel\Pub\Controller\ModeratorPanel->Andrew\ModeratorPanel\Pub\Controller\{closure}()
array_map() in src/addons/Andrew/ModeratorPanel/Pub/Controller/ModeratorPanel.php at line 53
Andrew\ModeratorPanel\Pub\Controller\ModeratorPanel->actionIndex() in src/XF/Mvc/Dispatcher.php at line 352
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 259
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 115
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2351
XF\App->run() in src/XF.php at line 517
XF::runApp() in index.php at line 20

Looks like it doesn't like:
PHP:
            //leftfix
            $finder = \XF::finder('XF:UserBan');
            $bannedusers_xfban = $finder
                ->with('User')
                ->order('ban_date', 'DESC')
                ->limit(10)
                ->fetch()->toArray();

            $bannedusers = array_map(function(\XF\Entity\UserBan $value): \XF\Entity\User {
                return $value->User;
            },$bannedusers_xfban);

here's quick and dirty fix.
this bugfix reduces sql query time 4 seconds to 0.4 ms with 13k users banned.
it will most likely do this when you have invalid user_id on xf_user_ban table
 
Last edited:
here's quick and dirty fix.
this bugfix reduces sql query time 4 seconds to 0.4 ms with 13k users banned.
it will most likely do this when you have invalid user_id on xf_user_ban table
Awesome, that worked. Now I noticed you only did it when showing spam users is true. I assume I should do this with the other queries as well?
 
Awesome, that worked. Now I noticed you only did it when showing spam users is true. I assume I should do this with the other queries as well?
yes that else condition should be changed aswell. as a owner of code you would understand better and do better fixes.
right now Im using 1.6 version of this and I'll wait this fixes to applied on 1.7.5 for upgrade.
 
yes that else condition should be changed aswell. as a owner of code you would understand better and do better fixes.
right now Im using 1.6 version of this and I'll wait this fixes to applied on 1.7.5 for upgrade.
Got it, I appreciate the help. I will probably deploy these fixes and and a few others to my life site tonight for testing and then release sometime this week.
 
View attachment 281123

site/moderatorpanel/
Takes 6 seconds to load. why its slow? is there any way to fix or improve the load times. (it makes moderation panel unusable and pain to use honestly) I have 2m members in my xf_user table.
That finder query has been fixed thanks to @leftspace89. Please let me know if you come across something else. I run this add-on on two boards that have over 6.5M posts but their user counts top out at 17K.
 
FYI - one of my moderators reported that banned users and discouraged user lists are repeating across pages. I have fixed the issue and will lease a fix later tonight. I am going to peak at a few other things and see if I can include them in 1.7.7.
 
Hey there,

For one of our websites, we noticed that anytime a moderator remove's moderating from a user, the page just gets refreshed but doesn't remove the moderation. It doesn't seem like this issue is affecting my other sites, any idea where I should look or what may be causing this issue?

No errors were logged, and there was nothing in the console.
 
Hey there,

For one of our websites, we noticed that anytime a moderator remove's moderating from a user, the page just gets refreshed but doesn't remove the moderation. It doesn't seem like this issue is affecting my other sites, any idea where I should look or what may be causing this issue?

No errors were logged, and there was nothing in the console.
What version are you running?
 
Can you walk me through how you know they are still being moderated?
Yeah, sure!

So when you click on the gear and click "remove moderation" it will refresh, and when you check again, instead of saying "Moderate" it says "remove moderation" still.

After doing that, I checked the Admincp and noticed the group was still under the assigned user groups.
 
Yeah, sure!

So when you click on the gear and click "remove moderation" it will refresh, and when you check again, instead of saying "Moderate" it says "remove moderation" still.

After doing that, I checked the Admincp and noticed the group was still under the assigned user groups.
Can you check the admin panel and see if they are still in the "Moderator Queue" user group?
 
Top Bottom