asp_buddyp_results
Gives access the budyypress results results array before sending it to the templating system.
1
apply_filters('asp_buddyp_results', $results, $search_id, $args);
Copied!

Parameters

  • $results (array) - Array containing the result objects.
  • $search_id (int) - Search instance ID
  • $args (array) - Search arguments

Usage

1
add_filter( 'asp_buddyp_results', 'asp_buddypress_result_filter', 10, 3 );
2
function asp_buddypress_result_filter( $results, $search_id, $args ) {
3
$link = 'https://www.google.com/'; // Link to use, when not logged in
4
5
// Parse through each result item
6
foreach ($results as $k=>&$r) {
7
/**
8
* $r (stdClass object) {
9
* 'id' -> Buddypress item ID,
10
* 'title' -> Result title
11
* 'content' -> Result content
12
* 'content_type' -> Content type (pagepost, user, term, attachment etc..)
13
* }
14
**/
15
if ( !is_user_logged_in() )
16
$r->link = $link;
17
}
18
19
return $results;
20
}
Copied!
Last modified 1yr ago
Copy link