Skip to:

Opened 8 years ago

Closed 8 years ago

#2988 closed defect (bug) (fixed)

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

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


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 8 years ago.

Download all attachments as: .zip

Change History (3)

8 years ago

#1 @johnjamesjacoby
8 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
8 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.