Skip to:
Content

BuddyPress.org


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.