#3694 closed defect (bug) (fixed)
Irrelevant database queries occurring in `BBP_Forums_Group_Extension::map_group_forum_meta_caps()` method
| Reported by: | r-a-y | Owned by: | johnjamesjacoby |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.6.20 |
| Component: | Extend - BuddyPress | Version: | 2.6.18 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | r-a-y, emaralive |
Description
In bbPress 2.6.18, there was a change to the BBP_Forums_Group_Extension::map_group_forum_meta_caps() method to check the post type before the capability check:
https://github.com/bbpress/bbPress/blame/2.6/src/includes/extend/buddypress/groups.php#L405-L441
The problem here is the post type checks take place before the capability check, so this method can run unnecessarily for other non-bbPress capabilities. This currently causes a @SELECT *
FROM wp_1_posts WHERE ID = 1 LIMIT 1@ database query to occur for each cap check that passes through the 'map_meta_cap' filter. On our BuddyPress install, about 15 of these database queries take place.
Attached patch adds a simple cap check against the caps checked inside the map_group_forum_meta_caps() method to address this issue.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
In 7829: