#38578 closed defect (bug) (fixed)
`locale` is not a per-site user-option, but rather a global user attribute
| Reported by: | johnjamesjacoby | Owned by: | ocean90 |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.7 |
| Component: | I18N | Version: | 4.7 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
In user-edit.php we're using get_user_option() to get a user's locale. This seems incorrect.
- It's the only user setting doing this in this file.
- User locale's are not per-site (
get_user_option()isn't specific for this, but it's *mostly* implied IMO.) - We already have
$profileuserwhich is aWP_Userobject, so we can rely on the magic getter to gather this meta. - We could also use
get_user_locale(), but sinceuser-edit.phpdoes it's own juggle against the results ofget_available_languages()I thinkget_user_locale()includes unnecessary overhead. _get_additional_user_keys()includeslocaleas a global piece of meta (not as a per-site option) which I think confirms my thoughts.
See: #29783.
Attachments (1)
Change History (5)
#2
@
10 years ago
Looks like a leftover from my initial patch.
Note that get_user_option() checks first if a site specific meta exists and then falls back to the global attribute.
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Also,
wp_insert_user()sets thelocaleuser meta usingupdate_user_meta(). It's never saved as a per-site user option, so I don't thinkget_user_option()is the correct approach in this instance.The bug here, to be clear, is if there was somehow a
wp_2_localekey inwp_usermeta(maybe from a plugin?) it would be what appears as selected in the dropdown... but when the user is updated, it would update thelocalekey, which is what everything else uses.