Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#4957 closed defect (bug) (wontfix)

bp_setup_current_user and _doing_it_wrong

Reported by: netweblogic's profile netweblogic Owned by:
Milestone: Priority: normal
Severity: minor Version:
Component: Core Keywords:
Cc:

Description

considering that functions like this are available at plugins_loaded, should _doing_it_wrong really be called in this sort of situation?

add_action( 'plugins_loaded', 'am_i_really_wrong');
function am_i_really_wrong(){ 
  if( current_user_can('list_users') ){ 
    //did it wrong?
  }
}

The warning is triggered when in WP_DEBUG mode.

I may be missing something here... but until now this has never caused a problem.

Change History (3)

#1 @johnjamesjacoby
12 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

Most of WordPress is available by the time the 'muplugins_loaded' action fires, but many API's like Localization and Roles aren't ready to be loaded until later in the stack. The currently logged in user is no exception to this.

It's a common mistake, and even WordPress core does it wrong in 1 place; see #WP24169.

The debug notice is annoying, but invoking the current user that early in the stack is going to cause a myriad of other invisible issues with both BuddyPress and bbPress. Closing this as wontfix.

#2 @DJPaul
12 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.