Fixed N+1 query behaviour in What's New profile posts with banned users


Well-known member
Affected version
2.2.6 Patch 1
Hidden behind a redirect is a bunch of N+1 query behaviour from the view check, if a number of profile posts exist on a banned user

ProfileUser.Ban needs to be loaded to check if the user is permanently banned. If so, then the user profile is hidden from the result set.

Should add a with statement;
protected function applyFilters(XF\Finder\ProfilePost $profilePostFinder, array $filters)

And/or then update canViewFullProfile to move the canBypassUserPrivacy to before accessing the relationship.

Or filter out banned users in the query which is probably a better solution to the additional join
Last edited:

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.7).

Change log:
Avoid n+1 queries when filtering profile posts from banned users in the find new system
There may be a delay before changes are rolled out to the XenForo Community.