Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Limiting search to ‘Full Name’ field


talk2manoj
Participant

@talk2manoj

I don’t want to encourage you to do hard-coded changes, but if you want to, here are the instructions

1. Open wp-content->plugins->buddypress->bp-core->bp-core-classes.php

2. replace line 247 and 248 by following code

$total_users_sql = apply_filters( 'bp_core_search_users_count_sql', "SELECT DISTINCT count(u.ID) as user_id FROM " . CUSTOM_USER_TABLE . " u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id WHERE pd.field_id=1 AND pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC", $search_terms );
$paged_users_sql = apply_filters( 'bp_core_search_users_sql', "SELECT DISTINCT u.ID as user_id FROM " . CUSTOM_USER_TABLE . " u LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id WHERE pd.field_id=1 AND pd.value LIKE '%%$search_terms%%' ORDER BY pd.value ASC{$pag_sql}", $search_terms, $pag_sql );

in above code “pd.field_id=1” should be the id of Full Name field ( I think its 1 )

Skip to toolbar