_bb_get_salt

The BuddyPress bb get salt function.

Description

_bb_get_salt( $constants, (bool) $option = false ); 

Parameters (2)

0. $constants
The constants.
1. $option — Optional. (bool) => false
The option.

Usage

  1. if ( !function_exists( '_bb_get_salt' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-pluggable.php'; 
  3.  
  4. // The constants. 
  5. $constants = null; 
  6.  
  7. // The option. 
  8. $option = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = _bb_get_salt($constants, $option); 
  12.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-pluggable.php  
  1. function _bb_get_salt( $constants, $option = false ) 
  2. if ( !is_array( $constants ) ) { 
  3. $constants = array( $constants ); 
  4.  
  5. foreach ($constants as $constant ) { 
  6. if ( defined( $constant ) ) { 
  7. return constant( $constant ); 
  8.  
  9. if ( !defined( 'BB_INSTALLING' ) || !BB_INSTALLING ) { 
  10. if ( !$option ) { 
  11. $option = strtolower( $constants[0] ); 
  12. $salt = bb_get_option( $option ); 
  13. if ( empty( $salt ) ) { 
  14. $salt = bb_generate_password( 64 ); 
  15. bb_update_option( $option, $salt ); 
  16. return $salt; 
  17.  
  18. return '';