Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#38512 closed enhancement (fixed)

Add $user argument to get_user_locale()

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

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 10 years ago.

Download all attachments as: .zip

Change History (5)

#1 @ocean90
10 years ago

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

#2 @ocean90
10 years ago

  • Component Users → I18N

#3 @ocean90
10 years ago

  • Owner set to ocean90
  • Resolution → fixed
  • Status new → 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.


10 years ago

Note: See TracTickets for help on using tickets.