Re: Advanced Search plugin needed
I was able to make an advanced search page by manipulating this line in bp-core-classes.php.
$sql[‘where_searchterms’] = “AND pd.value LIKE ‘%%$search_terms%%'”;
Example: Let’s say you have a profile field called “Location” whose field_id in the bp-xprofile-data table is 5, and you have a profile field called “Gender” whose field_id is 12. Then to search all females whose location start with “Los” you could replace that line above with:
$sql[‘where_searchterms’] = “
AND
EXISTS (
SELECT *
FROM wp_bp_xprofile_data
WHERE
wp_bp_xprofile_data.value like ‘los%%’
AND wp_bp_xprofile_data.field_id =5
and wp_bp_xprofile_data.user_id=pd.user_id
)
AND
EXISTS (
SELECT *
FROM wp_bp_xprofile_data
WHERE
wp_bp_xprofile_data.value = ‘FEMALE’
AND wp_bp_xprofile_data.field =12
and wp_bp_xprofile_data.user_id=pd.user_id
)
AND pd.field_id=1
“
Of course, to make a fully functional advanced search page there’s a lot more than just that, but it demonstrates the basic idea. If anyone finds this helpful or wants an elaboration, let me know.