Skip to:
Content

bbPress.org

Opened 10 years ago

Closed 10 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 Owned by: johnjamesjacoby
Priority: normal Milestone: 2.6
Component: API - Roles/Capabilities Version: trunk
Severity: normal 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 10 years ago.

Download all attachments as: .zip

Change History (3)

@jmdodd
10 years ago

#1 @johnjamesjacoby
10 years ago

  • Keywords needs-refresh added
  • Milestone Awaiting Review2.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
10 years ago

  • Owner set to johnjamesjacoby
  • Resolutionfixed
  • Status newclosed

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.