add_filter( 'asp_buddyp_results', 'asp_buddypress_result_filter', 10, 3 );
function asp_buddypress_result_filter( $results, $search_id, $args ) {
$link = 'https://www.google.com/'; // Link to use, when not logged in
// Parse through each result item
foreach ($results as $k=>&$r) {
/**
* $r (stdClass object) {
* 'id' -> Buddypress item ID,
* 'title' -> Result title
* 'content' -> Result content
* 'content_type' -> Content type (pagepost, user, term, attachment etc..)
* }
**/
if ( !is_user_logged_in() )
$r->link = $link;
}
return $results;
}