Opened 9 years ago
Closed 9 years ago
#7513 closed defect (bug) (fixed)
bp_group_has_members performs unnecessary query
| Reported by: | brandonliles | Owned by: | dcavins |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.9 |
| Component: | Groups | Version: | 1.0 |
| Severity: | normal | 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
@
9 years ago
- Component Core → Groups
- Keywords 2nd-opinion added
- Milestone Awaiting Review → 2.9
- Owner set to
- Status new → accepted
- Version → 1.0
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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 => falseis passed toBP_Groups_Group_Members_Templateso that ultimatelyBP_User_Querystops 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