bp_activity_get_actions_for_context

Gets a flat list of activity actions compatible with a given context.

Description

(array) bp_activity_get_actions_for_context( (string) $context = '' ); 

Returns (array)

Parameters (1)

0. $context — Optional. (string) => ''
Name of the context. Defaults to the current context.

Usage

  1. if ( !function_exists( 'bp_activity_get_actions_for_context' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-functions.php'; 
  3.  
  4. // Optional. Name of the context. Defaults to the current context. 
  5. $context = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_activity_get_actions_for_context($context); 
  9.  

Defined (1)

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

/bp-activity/bp-activity-functions.php  
  1. function bp_activity_get_actions_for_context( $context = '' ) { 
  2. if ( ! $context ) { 
  3.  
  4. $actions = array(); 
  5. foreach ( bp_activity_get_actions() as $component_actions ) { 
  6. foreach ( $component_actions as $component_action ) { 
  7. if ( in_array( $context, (array) $component_action['context'], true ) ) { 
  8. $actions[] = $component_action; 
  9.  
  10. return $actions;