Commit 01ce1b83 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

If user has chosen a language when logged out, save it to their account prefs when they log in


Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 303f5c54
......@@ -1137,6 +1137,13 @@ class LiveUser extends User {
$this->activityprefs = load_activity_preferences($user->id);
$this->accountprefs = load_account_preferences($user->id);
// If user has chosen a language while logged out, save it as their lang pref.
$sessionlang = $this->SESSION->get('lang');
if (!empty($sessionlang) && $sessionlang != 'default'
&& (empty($this->accountprefs['lang']) || $sessionlang != $this->accountprefs['lang'])) {
$this->set_account_preference('lang', $sessionlang);
}
// Set language for the current request
if (!empty($this->accountprefs['lang'])) {
current_language($this->accountprefs['lang']);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment