Report Improvements by Xon

Report Improvements by Xon 2.20.8

No permission to download
Just grant the "view post report" permission via a user-group to all moderators which will let them see all post reports. Using the content moderator option only grants this permission per-forum.
That's the problem. I don't want moderators of specific forums to see all post reports. Without this add installed, they see just reports for their forums. WITH this addon installed, they see all reports for every part of the overall forums. Not desirable, they shouldn't see reports that aren't within their purview.
I do assign a usergroup along with the moderator permission set. The only other specific moderator permissions I set are within the "Forum moderator permissions" section, for the forum(s) they're moderator of.

Since you mentioned the "view post report" permission, that does get set by default for this addon on the usergroup they're assigned to. If I disable that permission, then they can no longer see ANY reports at all. Including ones within the forums they moderate. Also obviously not desirable.

So again, without this addon, things work as I'd expect, moderators see only relevant reports. With this addon installed, either they can see all reports, or they see none whatsoever, depending on that permission you just mentioned.
 
In that case you need to just grant the "view post report" permission for the target forum for the moderators. The setup code should have applied that permission for forums they can issue warnings for.
 
In that case you need to just grant the "view post report" permission for the target forum for the moderators. The setup code should have applied that permission for forums they can issue warnings for.
Ah, thank you, that does indeed work. Between messing with usergroup permissions and moderator permissions trying to figure out why those moderators could suddenly see every report, I must have missed the winning combination there.
With that permission removed from the usergroup (which got default added to the group, I assume based on some other existing permission), and properly set in the moderator permissions (which as you say was indeed properly default added to existing moderators), it is again correctly displaying only the reports those limited moderators.

Thanks!
 
Does this have the possibility for the reporter to select from a small (drop down?) list of reasons for the report?
With different categories of reports being directed to relevant moderators?

ie

Fraud warning
Harassment / bullying
Political / religous discussion

Thank you...
 
I have another of Xons addons,
but not this one
As I now have 4 mods I am looking at it.
What are the main advantages
And is there any way of marking hundreds of old Reports as Resolved?
 
This add-on does allow using the inline mod tools in reports, so it does make it easier to bulk-resolve reports
 
I haven't fully tracked this down yet, but it seems like

PHP:
unset($this->_relations['Report']);

in SV\ReportImprovements\XF\Entity\ApprovalQueue::setContent
may cause N+1 behaviour when XF\Repository\ApprovalQueueRepository::addContentToUnapprovedItems is called
 
The approval queue in general is something of a mess; bolting on the report behavior stuff probably needs a rewrite as discovering the actual report for content in the report queue is harder than it should be. There aren't many sane hook point for injecting that as well.

Unless the approval queue explodes to hundreds of items this shouldn't be too bad.
 
I just noticed it as we had around 3K items in the queue ;)
That will do it. The 2.20.4 will only load reports for content being displayed instead of all of possible approval queue items, and will attempt to load reports in a batch instead of the previous N+1 query way.

Honestly the approval queue just isn't designed for having too many items in it :(
 
Last edited:
I'm recently running into PHP out-of-memory problems on our large forum since after updating to 2.20.6 of this mod, with no clear cause indicated in the error log. So I can't say for certain it's this addon, except by correlation of update timing and more importantly the place it occurs.
Example XF admin panel error:
Code:
    ErrorException: Fatal Error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) src/XF/PermissionCache.php:184
    Generated by: Janus Aug 7, 2025 at 3:28 PM

Stack trace

#0 [internal function]: XF::handleFatalError()
#1 {main}

Request state

array(4) {
  ["url"] => string(24) "/index.php?reports/7352/"
  ["referrer"] => string(48) "https://forums.taleworlds.com/index.php?reports/"
  ["_GET"] => array(1) {
    ["reports/7352/"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}
As you can see, the stack trace only indicates XF itself, not any addon. But it only happens when trying to view a report, and results in the server returning a 500 error. It's consistently failing to load report pages now for me, erroring every time.

I tried rebuilding the XF permission cache completely through the admin panel first based on the source file it's erroring in, and the rebuild went without a hitch, but the problem persisted. I've also tried temporarily increasing PHP's memory limit and found that 512 MB or higher does take care of it, but that seems excessive to have allocated to every PHP worker. And I've only noticed this problem pop up when viewing reports specifically; not definitive, though, of course. Oh, and I also notice that even with that memory increase, individual report pages seem to load significantly slower than other pages of the forums. Taking close to a second to load, versus normal fraction of a second page loads.

I decided to try disabling addons to check for possible culprits with PHP's memory limit reverted back down from the above test, and since this addon seemed the most likely related, I started by disabling it alone. The problem went away, and I could again view any report quickly without error. I re-enabled this addon, and again consistently get a server error trying to view any report. Disabled it again, and again I can view reports.
Tried disabling a couple other addons temporarily which are likewise related to reports or the moderator panel, the error persisted with them disabled. The problem went away only with this addon specifically disabled.

So the problem does seem to be caused or at the very least exacerbated by this addon, very likely related to permission checks. I wish XF had a more useful stack trace for this.
 
Last edited:
Can you check how many open reports and unapproved items you have?

SQL:
select count(*) from xf_report where report_state in ('open', 'assigned');
select count(*) from xf_approval_queue;

How XF maintains a count of those is kinda janky and requires loading all the items links to those and it doesn't scale at all.
 
Back
Top Bottom