#7305 closed defect (bug) (fixed)
get_user_locale() always loads current user before init
Reported by: | johnjamesjacoby | Owned by: | djpaul |
---|---|---|---|
Milestone: | 2.7.1 | Priority: | high |
Severity: | major | Version: | 2.7 |
Component: | Core | Keywords: | needs-patch needs-testing |
Cc: | stephen@…, gary@…, slaFFik, leho@… |
Description
In WordPress 4.7, the get_user_locale()
function will always invoke the current user object before the init
hook has fired.
This results in the very common The current user is being initialized without using $wp->init()
notice on every page load.
Looks like it's time to retire this notice for good, and patch the unintended consequences of this reorder.
Attachments (1)
Change History (14)
#2
follow-up:
↓ 4
@
8 years ago
Can we do something smart like not sending a notice for the get_user_locale() instance -- perhaps via backtrace detection -- and keep the rest in place?
Or, only throw the notice if it's coming from a BuddyPress plugin file.
#3
@
8 years ago
Would https://core.trac.wordpress.org/ticket/23016#comment:16 help BuddyPress too?
#4
in reply to:
↑ 2
@
8 years ago
Replying to DJPaul:
Can we do something smart like not sending a notice for the get_user_locale() instance -- perhaps via backtrace detection -- and keep the rest in place?
I don't think so, because this is just the way WordPress is going to work now. It may actually be for the better, since BuddyPress originally was a big offender of this back-in-the-day (when we would load the current user early and send them to purgatory of they were a spammer.)
Replying to ocean90:
Would https://core.trac.wordpress.org/ticket/23016#comment:16 help BuddyPress too?
I think so, yes, but it needs testing to confirm. BuddyPress doesn't use primitive roles yet, but it has used mapped capabilities, and we've wanted to have primitive roles for a long while.
#5
@
8 years ago
In #WP23016, the wp_roles_init
action is what BuddyPress & bbPress would use going forward, so in that case, yes.
I still want to work that out over there, and confirm that it works as intended for bbPress's JIT roles setup.
#8
@
8 years ago
- Milestone changed from Awaiting Review to 2.7.1
As always, if someone patches something in the Awaiting Review milestone, *please* move it out to somewhere more appropriate. Patches get missed here.
See #WP26511, #WP24169, #6046.