Skip to:

Re: Making autocomplete work for all users

I’m getting closer! I got it working by changing one line in the search_friends function. This function is found inside the BP_Friends_Friendship class in the bp-friends-classes.php file. This change will break all other friend searches but at least I got the autocomplete working so that it searches on ALL members instead of just your friends. Now I just have to figure out how to do it within my theme instead of with core hacking.

Here’s the change:

Line 154 of bp-friends-classes.php
change: $fids = implode( ‘,’, $friend_ids );
to: $fids = implode( ‘,’, $wpdb->get_col( “SELECT $wpdb->users.ID FROM $wpdb->users”) );

So basically… I’m just feeding the SQL query (a few lines down in the function) a list of ALL user ids instead of only friend ids.

Skip to toolbar