[buddypress-trac] [BuddyPress Trac] #7436: Very slow check_is_friend function

buddypress-trac noreply at wordpress.org
Wed Feb 8 17:46:16 UTC 2017


#7436: Very slow check_is_friend function
--------------------------+--------------------
 Reporter:  januzi_pl     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  low           |   Milestone:  2.7.5
Component:  Friends       |     Version:  2.7
 Severity:  major         |  Resolution:
 Keywords:  dev-feedback  |
--------------------------+--------------------

Comment (by dcavins):

 Hm. Since `bp_friends_filter_user_query_populate_extras()` is passed the
 list of user IDs to check against, it can (and used to do) a single query
 to get the friendship status of all members visible on a directory, for
 instance. That setup won't prep the cache for the various other ways
 friendship is used during a page load, but it could help @januzi_pl, in
 the short term.

 Remove the current filter:
 `remove_filter( 'bp_user_query_populate_extras',
 'bp_friends_filter_user_query_populate_extras', 4, 2 );`
 then add a new filter to a custom function using the old logic:
 https://buddypress.trac.wordpress.org/browser/tags/2.5.0/src/bp-friends
 /bp-friends-filters.php

 Totally unrelated, why doesn't `bp_core_get_users()` return `BP_Core_User`
 objects?  I can never remember what type of user object is returned in the
 various contexts. Maybe that is the next standardization/caching frontier.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7436#comment:9>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list