[buddypress-trac] [BuddyPress Trac] #6601: BP calls update_meta_cache() 5997 times per page load

buddypress-trac noreply at wordpress.org
Thu Aug 27 03:09:04 UTC 2015


#6601: BP calls update_meta_cache() 5997 times per page load
-----------------------------------+----------------------
 Reporter:  wcvendors              |       Owner:  r-a-y
     Type:  defect (bug)           |      Status:  closed
 Priority:  high                   |   Milestone:
Component:  Component - Messaging  |     Version:  2.3.2
 Severity:  major                  |  Resolution:  invalid
 Keywords:                         |
-----------------------------------+----------------------

Comment (by wcvendors):

 Thank you @boonebgorges


 {{{
 /* BuddyPress change members directory to only show vendors */
 add_action('bp_ajax_querystring','bpdev_exclude_users',20,2);
 function bpdev_exclude_users($qs=false,$object=false){
     //list of users to exclude

     $excluded_user=join(',',bpdev_get_subscriber_user_ids());//comma
 separated ids of users whom you want to exclude

     if($object!='members')//hide for members only
         return $qs;

     $args=wp_parse_args($qs);

     //check if we are searching for friends list etc?, do not exclude in
 this case
     if(!empty($args['user_id']))
         return $qs;

     if(!empty($args['exclude']))
         $args['exclude']=$args['exclude'].','.$excluded_user;
     else
         $args['exclude']=$excluded_user;

     $qs=build_query($args);


    return $qs;

 }

 function bpdev_get_subscriber_user_ids(){
     $users=array();
     $subscribers= get_users( array( 'role' => 'customer' ) );
    if(!empty($subscribers)){
        foreach((array)$subscribers as $subscriber)
            $users[]=$subscriber->ID;
    }
    return $users;
 }


 }}}

 It appears this old legacy code was the issue in themes functions.php
 file.  I've removed it and simply modified the template for the /members/
 directory instead to show nothing instead, which is the true intent.

 Appreciate your fast support, and apologies for thinking this was a
 general BuddyPress bug.

 Ben

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


More information about the buddypress-trac mailing list