Skip to:
Content

BuddyPress.org

Ticket #8998: 8998.patch

File 8998.patch, 9.3 KB (added by plugindevs, 19 months ago)
  • src/bp-core/admin/bp-core-admin-settings.php

    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 ); 
    452452function bp_form_option( $option, $default = '' , $slug = false ) {
    453453        echo bp_get_form_option( $option, $default, $slug );
    454454}
    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                 }
    485455
    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 */
     467function 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 ) {
    489474
    490475                /**
    491                  * Filters the settings API option.
     476                 * Filters the slug value in the form field.
    492477                 *
    493478                 * @since 1.6.0
    494479                 *
    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.
    497481                 */
    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 );
    499485        }
     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}
  • src/bp-settings/bp-settings-template.php

    diff --git src/bp-settings/bp-settings-template.php src/bp-settings/bp-settings-template.php
    index 4c5c1d49b..1cd16abd0 100644
    defined( 'ABSPATH' ) || exit; 
    1818function bp_settings_slug() {
    1919        echo bp_get_settings_slug();
    2020}
     21
     22/**
     23 * Return the settings component slug.
     24 *
     25 * @since 1.5.0
     26 *
     27 * @return string
     28 */
     29function bp_get_settings_slug() {
     30
    2131        /**
    22          * Return the settings component slug.
     32         * Filters the Settings component slug.
    2333         *
    2434         * @since 1.5.0
    2535         *
    26          * @return string
     36         * @param string $slug Settings component slug.
    2737         */
    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}
    3940
    4041/**
    4142 * Output the settings component root slug.
    function bp_settings_slug() { 
    4546function bp_settings_root_slug() {
    4647        echo bp_get_settings_root_slug();
    4748}
     49
     50/**
     51 * Return the settings component root slug.
     52 *
     53 * @since 1.5.0
     54 *
     55 * @return string
     56 */
     57function bp_get_settings_root_slug() {
     58
    4859        /**
    49          * Return the settings component root slug.
     60         * Filters the Settings component root slug.
    5061         *
    5162         * @since 1.5.0
    5263         *
    53          * @return string
     64         * @param string $root_slug Settings component root slug.
    5465         */
    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}
    6668
    6769/**
    6870 * Add the 'pending email change' message to the settings page.