Reply To: Frontend search options for BuddyPress

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Frontend search options for BuddyPress Reply To: Frontend search options for BuddyPress


Ernest Marcinko


The problem is exactly what I was thinking, the ID of the item on the front-end contains “set_inexcerpt” which refers to a different item. If you change that, it will work correctly visually.

It still will not affect the search in any ways. This will only send additional data to the search handler, but since this new data is not handled, it won't do anything. The buddypress user group and topic search is indeed implemented, but there is no connection in the handler yet.

First, you should fix the front-end code to something like, and re-use this code for all 3:

Now, you don't need any of the back-end code, you can control this directly from here. You can copy-paste this code 3 times in the asp.shortcode.general.php, just change the $asp_front_option and the $asp_front_opt_text variables accordingly.

Then you need to add a handler to that, open the ajax-search-pro\includes\classes\etc\class-asp_helpers.php file and scroll to lines 429-435:

$args['bp_groups_search'] = $sd['search_in_bp_groups'] == 1;
$args['bp_groups_search_public'] = $sd['search_in_bp_groups_public'] == 1;
$args['bp_groups_search_private'] = $sd['search_in_bp_groups_private'] == 1;
$args['bp_groups_search_hidden'] = $sd['search_in_bp_groups_hidden'] == 1;
$args['bp_activities_search'] = $sd['search_in_bp_activities'] == 1;
if ($args['bp_groups_search'] || $sd['search_in_bp_activities'])
    $args['search_type'][] = "buddypress";

The $args array is passed to the search, the $sd array holds the search data, and the $o array are the search options, which you need.
So, add this line below line 435:

$args['bp_groups_search'] = isset($o['opt_bpgroup']);

This will now handle the option we created, and pass it on if it's selected to the arguments. You will have to do that for the other arguments you need as well.

Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)