bp_get_form_option

Return settings API option.

Description

(string) bp_get_form_option( (string) $option, (string) $default = '', (bool) $slug = false ); 

Returns (string)

Parameters (3)

0. $option (string)
Form option to return.
1. $default — Optional. (string) => ''
Form option default.
2. $slug — Optional. (bool) => false
Form option slug.

Usage

  1. if ( !function_exists( 'bp_get_form_option' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/admin/bp-core-admin-settings.php'; 
  3.  
  4. // Form option to return. 
  5. $option = ''; 
  6.  
  7. // Form option default. 
  8. $default = ''; 
  9.  
  10. // Form option slug. 
  11. $slug = false; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bp_get_form_option($option, $default, $slug); 
  15.  

Defined (1)

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

/bp-core/admin/bp-core-admin-settings.php  
  1. function bp_get_form_option( $option, $default = '', $slug = false ) { 
  2.  
  3. // Get the option and sanitize it. 
  4. $value = bp_get_option( $option, $default ); 
  5.  
  6. // Slug? 
  7. if ( true === $slug ) { 
  8.  
  9. /** 
  10. * Filters the slug value in the form field. 
  11. * @since 1.6.0 
  12. * @param string $value Value being returned for the requested option. 
  13. */ 
  14. $value = esc_attr( apply_filters( 'editable_slug', $value ) ); 
  15. } else { // Not a slug. 
  16. $value = esc_attr( $value ); 
  17.  
  18. // Fallback to default. 
  19. if ( empty( $value ) ) 
  20. $value = $default; 
  21.  
  22. /** 
  23. * Filters the settings API option. 
  24. * @since 1.6.0 
  25. * @param string $value Value being returned for the requested option. 
  26. * @param string $option Option whose value is being requested. 
  27. */ 
  28. return apply_filters( 'bp_get_form_option', $value, $option );