bb_get_option

Returns the requested bbPress option from the meta table or the $bb object.

Description

bb_get_option( (string) $option ); 

Parameters (1)

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

Usage

  1. if ( !function_exists( 'bb_get_option' ) ) { 
  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($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( $option ) 
  2. // Allow plugins to short-circuit options. 
  3. if ( false !== $r = apply_filters( 'bb_pre_get_option_' . $option, false, $option ) ) { 
  4. return $r; 
  5.  
  6. global $bb; 
  7.  
  8. switch ( $option ) { 
  9. case 'site_id': 
  10. if ( isset( $bb->site_id ) && is_numeric( $bb->site_id ) ) { 
  11. $r = (int) $bb->site_id; 
  12. } else { 
  13. $r = 1; 
  14. break; 
  15. case 'language': 
  16. $r = str_replace( '_', '-', bb_get_locale() ); 
  17. break; 
  18. case 'text_direction': 
  19. global $bb_locale; 
  20. $r = $bb_locale->text_direction; 
  21. break; 
  22. case 'version': 
  23. return '1.2'; // Don't filter 
  24. break; 
  25. case 'bb_db_version' : 
  26. return '2471'; // Don't filter 
  27. break; 
  28. case 'html_type': 
  29. $r = 'text/html'; 
  30. break; 
  31. case 'charset': 
  32. $r = 'UTF-8'; 
  33. break; 
  34. case 'bb_table_prefix': 
  35. case 'table_prefix': 
  36. global $bbdb; 
  37. return $bbdb->prefix; // Don't filter; 
  38. break; 
  39. case 'url': 
  40. $option = 'uri'; 
  41. default: 
  42. if ( isset( $bb->$option ) ) { 
  43. $r = $bb->$option; 
  44. if ( $option === 'mod_rewrite' ) { 
  45. if ( is_bool( $r ) ) { 
  46. $r = (int) $r; 
  47. break; 
  48.  
  49. $r = bb_get_option_from_db( $option ); 
  50.  
  51. if ( !$r ) { 
  52. switch ( $option ) { 
  53. case 'name': 
  54. $r = __( 'Please give me a name!' ); 
  55. break; 
  56. case 'wp_table_prefix' : 
  57. global $wp_table_prefix; // This global is deprecated 
  58. return $wp_table_prefix; // Don't filter; 
  59. break; 
  60. case 'mod_rewrite': 
  61. $r = 0; 
  62. break; 
  63. case 'page_topics': 
  64. $r = 30; 
  65. break; 
  66. case 'edit_lock': 
  67. $r = 60; 
  68. break; 
  69. case 'gmt_offset': 
  70. $r = 0; 
  71. break; 
  72. case 'uri_ssl': 
  73. $r = preg_replace( '|^http://|i', 'https://', bb_get_option( 'uri' ) ); 
  74. break; 
  75. case 'throttle_time': 
  76. $r = 30; 
  77. break; 
  78. case 'email_login': 
  79. $r = false; 
  80. break; 
  81. break; 
  82.  
  83. return apply_filters( 'bb_get_option_' . $option, $r, $option );