Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#10938 closed defect (bug) (fixed)

AtomPub redefines pluggable wp_set_current_user()

Reported by: mdawaffe's profile mdawaffe Owned by: westi's profile westi
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.8.4
Component: AtomPub Keywords: dev-feedback
Focuses: Cc:

Description

wp-app.php redefines the pluggable wp_set_current_user().

This means that plugins which redefine wp_set_current_user() don't work during a APP call.

Also the redefined function is identical to the core function except that it calls neither setup_userdata() nor do_action( 'set_current_user' ).

setup_userdata() defines some globals that plugins might rely on. And defining globals is basically all it does, so it's not very expensive.

The do_action( 'set_current_user' ) is important for plugins that need to sync user data, change caps, etc.

I have no insight into why wp-app.php needs to redefine the function.

Change History (4)

#1 follow-up: @westi
14 years ago

  • Owner changed from josephscott to westi
  • Status changed from new to accepted

I think it can just be ripped out.

As it never gets used.

wp-app.php pulls in wp-load.php at the top and by the time the function_exist check is reached the function is already defined.

#2 @westi
14 years ago

I think these can go as well:

/** Post Template API */
require_once(ABSPATH . WPINC . '/post-template.php');

/** Feed Handling API */
require_once(ABSPATH . WPINC . '/feed.php');

As they will also already be included.

#3 in reply to: ↑ 1 @mdawaffe
14 years ago

Replying to westi:

I think it can just be ripped out.

As it never gets used.

wp-app.php pulls in wp-load.php at the top and by the time the function_exist check is reached the function is already defined.

Ha. Good point :)

#4 @westi
14 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [12102]) Remove unnecessary and dead code from wp-app.php. Fixes #10938.

Note: See TracTickets for help on using tickets.