Skip to:
Content

BuddyPress.org

Changeset 10823


Ignore:
Timestamp:
05/29/2016 04:26:39 PM (9 years ago)
Author:
djpaul
Message:

Update the "bp_setup_current_user was called incorrectly" whitelist for the Customizer.

Change based on _wp_customize_include.
The previous approach was not working on recent versions of WordPress because the global wasn't set yet.

Fixes #7086

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-dependency.php

    r10719 r10823  
    208208 * Set up the currently logged-in user.
    209209 *
    210  * We white-list the WordPress customizer which purposely loads the user early.
     210 * We white-list the WordPress Customizer which purposely loads the user early.
     211 * If the current user is being setup before the "init" action has fired,
     212 * strange (and difficult to debug) role/capability issues will occur.
    211213 *
    212214 * @since 1.7.0
     
    219221 */
    220222function bp_setup_current_user() {
    221 
    222     // If the current user is being setup before the "init" action has fired,
    223     // strange (and difficult to debug) role/capability issues will occur.
    224     if ( ! isset( $GLOBALS['wp_customize'] ) && ! did_action( 'after_setup_theme' ) ) {
     223    $skip_warning = (
     224        ( isset( $_REQUEST['wp_customize'] ) && 'on' === $_REQUEST['wp_customize'] ) ||
     225        ( is_admin() && 'customize.php' === basename( $_SERVER['PHP_SELF'] ) )
     226    );
     227
     228    if ( ! $skip_warning && ! did_action( 'after_setup_theme' ) ) {
    225229        $e = new Exception;
    226230        $trace = $e->getTraceAsString();
Note: See TracChangeset for help on using the changeset viewer.