bbp_is_activation

Determine if bbPress is being activated.

Description

bbp_is_activation( (string) $basename = '' ); 

Note that this function currently is not used in bbPress core and is here for third party plugins to use to check for bbPress activation.

Parameters (1)

0. $basename — Optional. (string) => ''
The basename.

Usage

  1. if ( !function_exists( 'bbp_is_activation' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/core/update.php'; 
  3.  
  4. // The basename. 
  5. $basename = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_is_activation($basename); 
  9.  

Defined (1)

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

/includes/core/update.php  
  1. function bbp_is_activation( $basename = '' ) { 
  2. global $pagenow; 
  3.  
  4. $bbp =bbpress); 
  5. $action = false; 
  6.  
  7. // Bail if not in admin/plugins 
  8. if ( ! ( is_admin() && ( 'plugins.php' === $pagenow ) ) ) { 
  9. return false; 
  10.  
  11. if ( ! empty( $_REQUEST['action'] ) && ( '-1' !== $_REQUEST['action'] ) ) { 
  12. $action = $_REQUEST['action']; 
  13. } elseif ( ! empty( $_REQUEST[''] ) && ( '-1' !== $_REQUEST[''] ) ) { 
  14. $action = $_REQUEST['']; 
  15.  
  16. // Bail if not activating 
  17. if ( empty( $action ) || !in_array( $action, array( 'activate', 'activate-selected' ) ) ) { 
  18. return false; 
  19.  
  20. // The plugin(s) being activated 
  21. if ( $action === 'activate' ) { 
  22. $plugins = isset( $_GET['plugin'] ) ? array( $_GET['plugin'] ) : array(); 
  23. } else { 
  24. $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); 
  25.  
  26. // Set basename if empty 
  27. if ( empty( $basename ) && !empty( $bbp->basename ) ) { 
  28. $basename = $bbp->basename; 
  29.  
  30. // Bail if no basename 
  31. if ( empty( $basename ) ) { 
  32. return false; 
  33.  
  34. // Is bbPress being activated? 
  35. return in_array( $basename, $plugins );