Opened 7 years ago
Closed 6 years ago
#7513 closed defect (bug) (fixed)
bp_group_has_members performs unnecessary query
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.9 | Priority: | normal |
Severity: | normal | Version: | 1.0 |
Component: | Groups | Keywords: | dev-feedback has-patch 2nd-opinion |
Cc: |
Description
The function bp_group_has_members defaults the query parameter 'search_terms' to null when there are no search terms, but BP_User_Query expects that 'search_terms' is false rather than null. This results in BP_User_Query issuing an unnecessary table scan on the users table.
Attachments (2)
Change History (9)
#2
@
7 years ago
- Component changed from Core to Groups
- Keywords 2nd-opinion added
- Milestone changed from Awaiting Review to 2.9
- Owner set to dcavins
- Status changed from new to accepted
- Version set to 1.0
Hi @brandonliles-
Thanks for finding this inefficiency! In reading the documentation for the function, it looks like fixing it is slightly more complicated than first thought.
The key part of your patch is that
search_terms => false
is passed toBP_Groups_Group_Members_Template
so that ultimatelyBP_User_Query
stops doingall the time. I've added some logic to make sure that our documentation is observed while keeping the core of your patch.
Great find!
-David