bp_activity_get_action

Retrieve the current action from a component and key.

Description

(string|bool) bp_activity_get_action( (string) $component_id, (string) $key ); 

Returns (string|bool)

Action value if found, otherwise false.

Parameters (2)

0. $component_id (string)
The unique string ID of the component.
1. $key (string)
The action key.

Usage

  1. if ( !function_exists( 'bp_activity_get_action' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-functions.php'; 
  3.  
  4. // The unique string ID of the component. 
  5. $component_id = ''; 
  6.  
  7. // The action key. 
  8. $key = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_activity_get_action($component_id, $key); 
  12.  

Defined (1)

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

/bp-activity/bp-activity-functions.php  
  1. function bp_activity_get_action( $component_id, $key ) { 
  2.  
  3. // Return false if any of the above values are not set. 
  4. if ( empty( $component_id ) || empty( $key ) ) { 
  5. return false; 
  6.  
  7. $actions = bp_activity_get_actions(); 
  8. $retval = false; 
  9.  
  10. if ( isset( $actions->{$component_id}->{$key} ) ) { 
  11. $retval = $actions->{$component_id}->{$key}; 
  12.  
  13. /** 
  14. * Filters the current action by component and key. 
  15. * @since 1.1.0 
  16. * @param string|bool $retval The action key. 
  17. * @param string $component_id The unique string ID of the component. 
  18. * @param string $key The action key. 
  19. */ 
  20. return apply_filters( 'bp_activity_get_action', $retval, $component_id, $key );