bbp_filter_get_user_option

Filter default options and allow them to be overloaded from inside the $bbp->user_options array.

Description

bbp_filter_get_user_option( (constant) $value = false, (string) $option = '', (int) $user = 0 ); 

Parameters (3)

0. $value — Optional. (constant) => false
Default value false
1. $option — Optional. (string) => ''
The option.
2. $user — Optional. (int)
The user.

Usage

  1. if ( !function_exists( 'bbp_filter_get_user_option' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/users/options.php'; 
  3.  
  4. // Optional. Default value false 
  5. $value = false; 
  6.  
  7. // The option. 
  8. $option = ''; 
  9.  
  10. // The user. 
  11. $user = -1; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bbp_filter_get_user_option($value, $option, $user); 
  15.  

Defined (1)

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

/includes/users/options.php  
  1. function bbp_filter_get_user_option( $value = false, $option = '', $user = 0 ) { 
  2. $bbp =bbpress); 
  3.  
  4. // Check the options global for preset value 
  5. if ( isset( $user->ID ) && isset( $bbp->user_options[$user->ID] ) && !empty( $bbp->user_options[$user->ID][$option] ) ) 
  6. $value = $bbp->user_options[$user->ID][$option]; 
  7.  
  8. // Always return a value, even if false 
  9. return $value;