bb_get_option_from_db

Retrieves and returns the requested bbPress option from the meta table.

Description

bb_get_option_from_db( (string) $option ); 

Parameters (1)

0. $option (string)
The option to be echoed

Usage

  1. if ( !function_exists( 'bb_get_option_from_db' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-meta.php'; 
  3.  
  4. // The option to be echoed 
  5. $option = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_get_option_from_db($option); 
  9.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-meta.php  
  1. function bb_get_option_from_db( $option ) 
  2. global $bbdb; 
  3. $option = bb_sanitize_meta_key( $option ); 
  4.  
  5. if ( wp_cache_get( $option, 'bb_option_not_set' ) ) { 
  6. $r = null; 
  7. } elseif ( false !== $_r = wp_cache_get( $option, 'bb_option' ) ) { 
  8. $r = $_r; 
  9. } else { 
  10. if ( BB_INSTALLING ) { 
  11. $bbdb->suppress_errors(); 
  12. $row = $bbdb->get_row( $bbdb->prepare( "SELECT `meta_value` FROM `$bbdb->meta` WHERE `object_type` = 'bb_option' AND `meta_key` = %s", $option ) ); 
  13. if ( BB_INSTALLING ) { 
  14. $bbdb->suppress_errors( false ); 
  15.  
  16. if ( is_object( $row ) ) { 
  17. $r = maybe_unserialize( $row->meta_value ); 
  18. } else { 
  19. $r = null; 
  20.  
  21. if ( $r === null ) { 
  22. wp_cache_set( $option, true, 'bb_option_not_set' ); 
  23. } else { 
  24. wp_cache_set( $option, $r, 'bb_option' ); 
  25.