Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#38512 closed enhancement (fixed)

Add $user argument to get_user_locale()

Reported by: ocean90's profile ocean90 Owned by: ocean90's profile ocean90
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.7
Component: I18N Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

Splitting this out of #26511.

The latest patch of #26511 does a lot of switch_to_locale( $user->locale ? $user->locale : get_locale() ); calls. This is exactly what get_user_locale() does for the current user. Adding a $user argument allows us to DRY up some logic.

Attachments (1)

38512.diff (1.8 KB) - added by ocean90 8 years ago.

Download all attachments as: .zip

Change History (5)

@ocean90
8 years ago

#1 @ocean90
8 years ago

  • Keywords has-patch has-unit-tests added; needs-patch needs-unit-tests removed

#2 @ocean90
8 years ago

  • Component changed from Users to I18N

#3 @ocean90
8 years ago

  • Owner set to ocean90
  • Resolution set to fixed
  • Status changed from new to closed

In 38955:

I18N: Add $user_id argument to get_user_locale().

This allows to retrieve the locale of any user with the additional fallback to the site locale.

Fixes #38512.
See #29783, #26511.

This ticket was mentioned in Slack in #core by stevenkword. View the logs.


8 years ago

Note: See TracTickets for help on using tickets.