bp_nouveau_get_temporary_setting( string $option = '', mixed $retval = false )

When previewing make sure to get the temporary setting of the customizer.

Description

This is necessary when we need to get these very early.

Parameters

$option

(Optional) the index of the setting to get.

Default value: ''

$retval

(Optional) the value to use as default.

Default value: false

Return

(mixed) The value for the requested option.

Source

File: bp-templates/bp-nouveau/includes/functions.php

522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
function bp_nouveau_get_temporary_setting( $option = '', $retval = false ) {
    if ( empty( $option ) || ! isset( $_POST['customized'] ) ) {
        return $retval;
    }
 
    $temporary_setting = wp_unslash( $_POST['customized'] );
    if ( ! is_array( $temporary_setting ) ) {
        $temporary_setting = json_decode( $temporary_setting, true );
    }
 
    // This is used to transport the customizer settings into Ajax requests.
    if ( 'any' === $option ) {
        $retval = array();
 
        foreach ( $temporary_setting as $key => $setting ) {
            if ( 0 !== strpos( $key, 'bp_nouveau_appearance' ) ) {
                continue;
            }
 
            $k            = str_replace( array( '[', ']' ), array( '_', '' ), $key );
            $retval[ $k ] = $setting;
        }
 
    // Used when it's an early regular request
    } elseif ( isset( $temporary_setting[ 'bp_nouveau_appearance[' . $option . ']' ] ) ) {
        $retval = $temporary_setting[ 'bp_nouveau_appearance[' . $option . ']' ];
 
    // Used when it's an ajax request
    } elseif ( isset( $_POST['customized'][ 'bp_nouveau_appearance_' . $option ] ) ) {
        $retval = $_POST['customized'][ 'bp_nouveau_appearance_' . $option ];
    }
 
    return $retval;
}

Changelog

Changelog
Version Description
BuddyPress 3.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.