WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im trying to find a way to set the members search by name and also by username.

Now it seems to search only by name.

Thanks in advance.

share|improve this question
up vote 2 down vote accepted

Somebody on the BuddyPress support forums had this to say:

I don’t recommend to change the core files of buddypress. The best way to do it is to write a custom code (I don’t know how to guide you). So if you don’t mind changing the core files, here is a quick way.

Open /buddypress/bp-core/bp-core-classes.php and change the

$sql['where_searchterms'] = “AND pd.value LIKE ‘%%$search_terms%%’”;

to

$sql['where_searchterms'] = “AND (pd.value LIKE ‘%%$search_terms%%’ OR 
    u.user_login LIKE’%%$search_terms%%’)” ;

If someone can guide us how to do it in bp-custom.php, it would be great.

share|improve this answer
    
Can somebody help us with a functions.php or bp-custom.php code to implement the above change? Thanks – Álvaro Castaño Nov 22 '11 at 15:42

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.