Commit 4078222d authored by Nelson Moller's avatar Nelson Moller Committed by Robert Lyon
Browse files

Bug 1703608: Selecting the lang for inst membership confirmation messages

Choosing the correct language for the confirmation message sent when
a user is added to an institution that has a different language than
the site default.

behatnotneeded

Change-Id: I832a18777654dc82d506e3d3a1238a74c6a6bdd7
parent c01b02cb
...@@ -299,16 +299,18 @@ class Institution { ...@@ -299,16 +299,18 @@ class Institution {
$user = get_record('usr', 'id', $user); $user = get_record('usr', 'id', $user);
} }
if ($lang = get_account_preference($user->id, 'lang')) { $lang = get_account_preference($user->id, 'lang');
// The user has a preset lang preference so we will use this if ($lang == 'default') {
} // The user does not have a preset lang preference so we will use the institution if it has one.
else if ($this->lang != 'default') { $institution_lang = !empty($this->configs['lang']) ? $this->configs['lang'] : 'default';
// The user hasn't been added yet, so we have to manually use this institution's lang if ($institution_lang != 'default') {
$lang = $this->lang; $lang = $institution_lang;
} }
else { else {
$lang = get_user_language($user->id); $lang = get_config('lang');
}
} }
$userinst = new StdClass; $userinst = new StdClass;
$userinst->institution = $this->name; $userinst->institution = $this->name;
$studentid = get_field('usr_institution_request', 'studentid', 'usr', $user->id, $studentid = get_field('usr_institution_request', 'studentid', 'usr', $user->id,
......
Supports Markdown
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