[buddypress-trac] [BuddyPress Trac] #7513: bp_group_has_members performs unnecessary query
buddypress-trac
noreply at wordpress.org
Wed Apr 26 17:25:13 UTC 2017
#7513: bp_group_has_members performs unnecessary query
------------------------------------------------+-----------------------
Reporter: brandonliles | Owner: dcavins
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 2.9
Component: Groups | Version: 1.0
Severity: normal | Resolution:
Keywords: dev-feedback has-patch 2nd-opinion |
------------------------------------------------+-----------------------
Changes (by dcavins):
* status: new => accepted
* component: Core => Groups
* owner: => dcavins
* version: => 1.0
* milestone: Awaiting Review => 2.9
* keywords: dev-feedback has-patch => dev-feedback has-patch 2nd-opinion
Comment:
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.
> $search_terms - Optional. Search terms to match. Pass an empty string to
force-disable search, even in the presence of $_REQUEST[s].
The key part of your patch is that `search_terms => false` is passed to
`BP_Groups_Group_Members_Template` so that ultimately `BP_User_Query`
stops doing
> WHERE ( user_login LIKE '%%'
> OR user_login LIKE '%%'
> OR user_nicename LIKE '%%'
> OR user_nicename LIKE '%%' ) ) )
all 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
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7513#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list