Hi Sarah,
I made a small modification to your plugin that allows me to achieve the “single term search” as I have dubbed it. The mod is a bit crude and does not pretend to fully integrate with all of the other DUD features, but I don’t think that would be too hard to do that if you wanted to make it available as part of the core functionality. In any case, here are the changes:
1) Add a new optional input to the dud_build_directory_query() function in core.php as follows (last argument):
function dud_build_directory_query(..., $single_term=NULL) {}
2) At the very end of the function right before the query syntax is returned, add this statement:
if (isset($single_term)) {$user_sql = 'SELECT DISTINCT bp.user_id from wp_bp_xprofile_data bp INNER JOIN wp_users wp ON wp.id = bp.user_id WHERE bp.value LIKE "%' . $single_term . '%" ORDER BY wp.display_name';
}
return $user_sql;
3) Add the following argument in DynamicUserDirectory() in the 2 instances where dud_build_directory_query() is called (lines 317 and 2033 in v. 1.8), also as last argument:
$user_sql = dud_build_directory_query(..., $_GET['term']);
Now on the page having the [DynamicUserDirectory] shortcode, e.g. http://www.mydomain/member-directory I can add an input field and button which calls the page with a URL argument containing the search term, i.e.
http://www.mydomain/member-directory?term=electronics
The directory will then be displayed filtered for all BP (xprofile) fields containing the string “electronics”.
A final version of this should probably only search fields that are defined in the DUD settings + a few other refinements I am sure.
Please let me know your thoughts.
Thanks
Dennis
-
This reply was modified 7 years, 3 months ago by
mrwassen.
-
This reply was modified 7 years, 3 months ago by
mrwassen.