bp_activity_filter_mentions_scope

Set up activity arguments for use with the 'favorites' scope.

Description

(array) bp_activity_filter_mentions_scope( (array) $retval = array(), (array) $filter = array() ); 

Returns (array)

$retval

Parameters (2)

0. $retval — Optional. (array) => array()
Empty array by default.
1. $filter — Optional. (array) => array()
Current activity arguments.

Usage

  1. if ( !function_exists( 'bp_activity_filter_mentions_scope' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-filters.php'; 
  3.  
  4. // Empty array by default. 
  5. $retval = array(); 
  6.  
  7. // Current activity arguments. 
  8. $filter = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_activity_filter_mentions_scope($retval, $filter); 
  12.  

Defined (1)

The function is defined in the following location(s).

/bp-activity/bp-activity-filters.php  
  1. function bp_activity_filter_mentions_scope( $retval = array(), $filter = array() ) { 
  2.  
  3. // Are mentions disabled? 
  4. if ( ! bp_activity_do_mentions() ) { 
  5. return $retval; 
  6.  
  7. // Determine the user_id. 
  8. if ( ! empty( $filter['user_id'] ) ) { 
  9. $user_id = $filter['user_id']; 
  10. } else { 
  11. $user_id = bp_displayed_user_id() 
  12.  
  13. // Should we show all items regardless of sitewide visibility? 
  14. $show_hidden = array(); 
  15. if ( ! empty( $user_id ) && $user_id !== bp_loggedin_user_id() ) { 
  16. $show_hidden = array( 
  17. 'column' => 'hide_sitewide',  
  18. 'value' => 0 
  19. ); 
  20.  
  21. $retval = array( 
  22. 'relation' => 'AND',  
  23. array( 
  24. 'column' => 'content',  
  25. 'compare' => 'LIKE',  
  26.  
  27. // Start search at @ symbol and stop search at closing tag delimiter. 
  28. 'value' => '@' . bp_activity_get_user_mentionname( $user_id ) . '<' 
  29. ),  
  30. $show_hidden,  
  31.  
  32. // Overrides. 
  33. 'override' => array( 
  34. 'display_comments' => 'stream',  
  35. 'filter' => array( 'user_id' => 0 ),  
  36. 'show_hidden' => true 
  37. ),  
  38. ); 
  39.  
  40. return $retval;