Commit c7303c7e authored by Richard Mansfield's avatar Richard Mansfield

Update the session language on change of user preference

When a user changes their language preference, this change ensures
that the session language is also updated at the same time.

This means the user language is retained when the user logs out,
and in the case where they remove their language preference
altogether, the session language (which is normally used in
preference to the site default) is cleared too.

Change-Id: I29236709643ce95586900b1ea4f75c69bf1a33d4
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 73196860
......@@ -287,6 +287,9 @@ function accountprefs_submit(Pieform $form, $values) {
db_commit();
if (isset($values['lang']) && $values['lang'] != $oldlang) {
// The session language pref is used when the user has no user pref,
// and when logged out.
$SESSION->set('lang', $values['lang']);
// Use PIEFORM_CANCEL here to force a page reload and show the new language.
$returndata['location'] = get_config('wwwroot') . 'account/index.php';
$SESSION->add_ok_msg(get_string_from_language($values['lang'], 'prefssaved', 'account'));
......
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