Skip to:
Content

Opened 2 years ago

Closed 2 years ago

#2988 closed defect (fixed)

Protect all calls to bbp_is_user_forum_moderator() with a bbp_allow_forum_mods() check

Reported by: jmdodd Owned by: johnjamesjacoby
Milestone: 2.6 Priority: normal
Severity: normal Version: trunk
Component: API - Roles/Capabilities Keywords: has-patch needs-refresh
Cc:

Description

bbp_is_user_forum_moderator() ultimately uses get_posts() to check if a forum has a postmeta for a given user id. When bbp_allow_forum_mods() is false, this check is unnecessary and results in multiple queries for the same information.

One query in includes/replies/capabilities.php already has this check; it is absent from topics and forums capabilities.

Attachments (1)

2988.diff (1.1 KB) - added by jmdodd 2 years ago.

Download all attachments as: .zip

Change History (3)

@jmdodd
2 years ago

#1 @johnjamesjacoby
2 years ago

  • Keywords needs-refresh added
  • Milestone changed from Awaiting Review to 2.6

Let's handle this inside of bbp_is_user_forum_moderator() so all usages benefit from this improvement.

Fix incoming. Thanks for finding & suggesting this improvement.

#2 @johnjamesjacoby
2 years ago

  • Owner set to johnjamesjacoby
  • Resolution set to fixed
  • Status changed from new to closed

In 6087:

Moderation: Skip moderator query if per-forum moderation is not enabled.

Props jmdodd. Fixes #2988.

Note: See TracTickets for help on using tickets.