bp_is_current_action

Check to see whether the current page matches a given action.

Description

bp_is_current_action( (string) $action = '' ); 

Along with bp_is_current_component() and bp_is_action_variable(), this function is mostly used to help determine when to use a given screen function.

In BP parlance, the current_action is the URL chunk that comes directly after the current item slug. E.g., in http://example.com/groups/my-group/members the current_action is members..

Parameters (1)

0. $action — Optional. (string) => ''
The action being tested against.

Usage

  1. if ( !function_exists( 'bp_is_current_action' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-template.php'; 
  3.  
  4. // The action being tested against. 
  5. $action = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_is_current_action($action); 
  9.  

Defined (1)

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

/bp-core/bp-core-template.php  
  1. function bp_is_current_action( $action = '' ) { 
  2. return (bool) ( $action === bp_current_action() );