Skip to:
Content

BuddyPress.org

Changeset 6765


Ignore:
Timestamp:
02/06/2013 05:52:42 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Add _doing_it_wrong() feedback to bp_setup_current_user(), to help debug role and capability issues when the current user is prematurely loaded.

Location:
trunk/bp-core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-actions.php

    r6762 r6765  
    3535add_action( 'init',                    'bp_init',                   10    );
    3636add_action( 'wp',                      'bp_ready',                  10    );
     37add_action( 'set_current_user',        'bp_setup_current_user',     10    );
    3738add_action( 'setup_theme',             'bp_setup_theme',            10    );
    3839add_action( 'after_setup_theme',       'bp_after_setup_theme',      10    );
  • trunk/bp-core/bp-core-dependency.php

    r6605 r6765  
    6969
    7070/**
     71 * Setup the currently logged-in user
     72 *
     73 * @uses did_action() To make sure the user isn't loaded out of order
     74 * @uses do_action() Calls 'bp_setup_current_user'
     75 */
     76function bp_setup_current_user() {
     77
     78    // If the current user is being setup before the "init" action has fired,
     79    // strange (and difficult to debug) role/capability issues will occur.
     80    if ( ! did_action( 'after_setup_theme' ) ) {
     81        _doing_it_wrong( __FUNCTION__, __( 'The current user is being initialized without using $wp->init().' ), '1.7' );
     82    }
     83
     84    do_action( 'bp_setup_current_user' );
     85}
     86
     87/**
    7188 * Initlialize code
    7289 */
Note: See TracChangeset for help on using the changeset viewer.