Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Either there’s something I seriously don’t understand, or there’s a rather counter-intuitive feature in the member search in BuddyPress: if you choose alphabetical order, the search only operates on the name of the member, rather than on all the extended profile fields. In other words, it applies the search terms to all the extended profile fields if you order by anything other than alphabetical. If you order by alphabetical, it applies the search terms to the name only. So if you keep the same search terms, but choose a different ordering, you get different members showing. This is counter intuitive, to say the least.

You can reproduce the problem (using out-of-the-box BuddyPress with the default theme) by doing a member search on some word that appears in an extended profile field for at least one member, but isn’t in anyone’s name. You will get some members listed. If you change the order to Alphabetical, they will disappear.

This appears to be because in get_users() (at around line 141 of bp_core_classes.php) we take only the name record in the profile data table, if the ordering is alphabetical. If the ordering isn’t alphabetical we keep all the records, which is what we want. I think the way round it is to do two separate joins, one to get the extended profile field records in so that they can be searched, and another to provide the term on which to do the ordering. I've tried the SQL, which works properly.

So the question is, is there any way round this, other than modifying the function in the core file on my site (which doesn’t seem a particularly good idea)? For instance, is there any way of overriding the get_users() function (which is a static function in the BP_Core_User class)? I really need the alphabetical ordering, as the other orderings are pretty meaningless to most of the users of my site.

Also, is this a known feature? Or is it a bug, in which case I should report it?

share|improve this question
add comment

1 Answer 1

I think you should report it. Additionally posting a patch with your SQL would be even better.

Even if it's done intentionally, you should at least obtain some info on how to get the behaviour you want without modifying BP files.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.