bp_action_variable

Return the value of a given action variable.

Description

(string|bool) bp_action_variable( (int) $position = 0 ); 

Returns (string|bool)

$action_variable The value of that position in the array, or false if not found.

Parameters (1)

0. $position — Optional. (int)
The key of the action_variables array that you want.

Usage

  1. if ( !function_exists( 'bp_action_variable' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-template.php'; 
  3.  
  4. // The key of the action_variables array that you want. 
  5. $position = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_action_variable($position); 
  9.  

Defined (1)

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

/bp-core/bp-core-template.php  
  1. function bp_action_variable( $position = 0 ) { 
  2. $action_variables = bp_action_variables(); 
  3. $action_variable = isset( $action_variables[ $position ] ) 
  4. ? $action_variables[ $position ] 
  5. : false; 
  6.  
  7. /** 
  8. * Filters the value of a given action variable. 
  9. * @since 1.5.0 
  10. * @param string|bool $action_variable Requested action variable based on position. 
  11. * @param int $position The key of the action variable requested. 
  12. */ 
  13. return apply_filters( 'bp_action_variable', $action_variable, $position );