diff --git src/bp-core/admin/bp-core-admin-settings.php src/bp-core/admin/bp-core-admin-settings.php
index b36d9140f..51c3c8058 100644
|
|
|
add_action( 'bp_admin_init', 'bp_core_admin_settings_save', 100 ); |
| 452 | 452 | function bp_form_option( $option, $default = '' , $slug = false ) { |
| 453 | 453 | echo bp_get_form_option( $option, $default, $slug ); |
| 454 | 454 | } |
| 455 | | /** |
| 456 | | * Return settings API option |
| 457 | | * |
| 458 | | * @since 1.6.0 |
| 459 | | * |
| 460 | | * |
| 461 | | * @param string $option Form option to return. |
| 462 | | * @param string $default Form option default. |
| 463 | | * @param bool $slug Form option slug. |
| 464 | | * @return string |
| 465 | | */ |
| 466 | | function bp_get_form_option( $option, $default = '', $slug = false ) { |
| 467 | | |
| 468 | | // Get the option and sanitize it. |
| 469 | | $value = bp_get_option( $option, $default ); |
| 470 | | |
| 471 | | // Slug? |
| 472 | | if ( true === $slug ) { |
| 473 | | |
| 474 | | /** |
| 475 | | * Filters the slug value in the form field. |
| 476 | | * |
| 477 | | * @since 1.6.0 |
| 478 | | * |
| 479 | | * @param string $value Value being returned for the requested option. |
| 480 | | */ |
| 481 | | $value = esc_attr( apply_filters( 'editable_slug', $value ) ); |
| 482 | | } else { // Not a slug. |
| 483 | | $value = esc_attr( $value ); |
| 484 | | } |
| 485 | 455 | |
| 486 | | // Fallback to default. |
| 487 | | if ( empty( $value ) ) |
| 488 | | $value = $default; |
| | 456 | /** |
| | 457 | * Return settings API option |
| | 458 | * |
| | 459 | * @since 1.6.0 |
| | 460 | * |
| | 461 | * |
| | 462 | * @param string $option Form option to return. |
| | 463 | * @param string $default Form option default. |
| | 464 | * @param bool $slug Form option slug. |
| | 465 | * @return string |
| | 466 | */ |
| | 467 | function bp_get_form_option( $option, $default = '', $slug = false ) { |
| | 468 | |
| | 469 | // Get the option and sanitize it. |
| | 470 | $value = bp_get_option( $option, $default ); |
| | 471 | |
| | 472 | // Slug? |
| | 473 | if ( true === $slug ) { |
| 489 | 474 | |
| 490 | 475 | /** |
| 491 | | * Filters the settings API option. |
| | 476 | * Filters the slug value in the form field. |
| 492 | 477 | * |
| 493 | 478 | * @since 1.6.0 |
| 494 | 479 | * |
| 495 | | * @param string $value Value being returned for the requested option. |
| 496 | | * @param string $option Option whose value is being requested. |
| | 480 | * @param string $value Value being returned for the requested option. |
| 497 | 481 | */ |
| 498 | | return apply_filters( 'bp_get_form_option', $value, $option ); |
| | 482 | $value = esc_attr( apply_filters( 'editable_slug', $value ) ); |
| | 483 | } else { // Not a slug. |
| | 484 | $value = esc_attr( $value ); |
| 499 | 485 | } |
| | 486 | |
| | 487 | // Fallback to default. |
| | 488 | if ( empty( $value ) ) |
| | 489 | $value = $default; |
| | 490 | |
| | 491 | /** |
| | 492 | * Filters the settings API option. |
| | 493 | * |
| | 494 | * @since 1.6.0 |
| | 495 | * |
| | 496 | * @param string $value Value being returned for the requested option. |
| | 497 | * @param string $option Option whose value is being requested. |
| | 498 | */ |
| | 499 | return apply_filters( 'bp_get_form_option', $value, $option ); |
| | 500 | } |
diff --git src/bp-settings/bp-settings-template.php src/bp-settings/bp-settings-template.php
index 4c5c1d49b..1cd16abd0 100644
|
|
|
defined( 'ABSPATH' ) || exit; |
| 18 | 18 | function bp_settings_slug() { |
| 19 | 19 | echo bp_get_settings_slug(); |
| 20 | 20 | } |
| | 21 | |
| | 22 | /** |
| | 23 | * Return the settings component slug. |
| | 24 | * |
| | 25 | * @since 1.5.0 |
| | 26 | * |
| | 27 | * @return string |
| | 28 | */ |
| | 29 | function bp_get_settings_slug() { |
| | 30 | |
| 21 | 31 | /** |
| 22 | | * Return the settings component slug. |
| | 32 | * Filters the Settings component slug. |
| 23 | 33 | * |
| 24 | 34 | * @since 1.5.0 |
| 25 | 35 | * |
| 26 | | * @return string |
| | 36 | * @param string $slug Settings component slug. |
| 27 | 37 | */ |
| 28 | | function bp_get_settings_slug() { |
| 29 | | |
| 30 | | /** |
| 31 | | * Filters the Settings component slug. |
| 32 | | * |
| 33 | | * @since 1.5.0 |
| 34 | | * |
| 35 | | * @param string $slug Settings component slug. |
| 36 | | */ |
| 37 | | return apply_filters( 'bp_get_settings_slug', buddypress()->settings->slug ); |
| 38 | | } |
| | 38 | return apply_filters( 'bp_get_settings_slug', buddypress()->settings->slug ); |
| | 39 | } |
| 39 | 40 | |
| 40 | 41 | /** |
| 41 | 42 | * Output the settings component root slug. |
| … |
… |
function bp_settings_slug() { |
| 45 | 46 | function bp_settings_root_slug() { |
| 46 | 47 | echo bp_get_settings_root_slug(); |
| 47 | 48 | } |
| | 49 | |
| | 50 | /** |
| | 51 | * Return the settings component root slug. |
| | 52 | * |
| | 53 | * @since 1.5.0 |
| | 54 | * |
| | 55 | * @return string |
| | 56 | */ |
| | 57 | function bp_get_settings_root_slug() { |
| | 58 | |
| 48 | 59 | /** |
| 49 | | * Return the settings component root slug. |
| | 60 | * Filters the Settings component root slug. |
| 50 | 61 | * |
| 51 | 62 | * @since 1.5.0 |
| 52 | 63 | * |
| 53 | | * @return string |
| | 64 | * @param string $root_slug Settings component root slug. |
| 54 | 65 | */ |
| 55 | | function bp_get_settings_root_slug() { |
| 56 | | |
| 57 | | /** |
| 58 | | * Filters the Settings component root slug. |
| 59 | | * |
| 60 | | * @since 1.5.0 |
| 61 | | * |
| 62 | | * @param string $root_slug Settings component root slug. |
| 63 | | */ |
| 64 | | return apply_filters( 'bp_get_settings_root_slug', buddypress()->settings->root_slug ); |
| 65 | | } |
| | 66 | return apply_filters( 'bp_get_settings_root_slug', buddypress()->settings->root_slug ); |
| | 67 | } |
| 66 | 68 | |
| 67 | 69 | /** |
| 68 | 70 | * Add the 'pending email change' message to the settings page. |