mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #43227
[Bug 1703608] [NEW] Institution addUserAsMember lang logic is flawed
Public bug reported:
The logic in charge of selecting the lang for the message does not work as expected.
The condition:
if ($lang = get_account_preference($user->id, 'lang')) {
// The user has a preset lang preference so we will use this
}
else if ($this->lang != 'default') {
// The user hasn't been added yet, so we have to manually use this institution's lang
$lang = $this->lang;
}
else {
$lang = get_user_language($user->id);
}
gets always sent in english if the site default lang is french.
To reproduce it:
You set another language than english as default language. You an institution with default lang and then you add a user (his lang preference is not setting) into this institution. He is going to receive an english message in that case and also in the case that the institution language is explicitly set to the additional lang.
That is corrected with the following:
$lang = get_account_preference($user->id, 'lang');
if ($lang == 'default') {
// The user has not a preset lang preference so we will use the institution if it has one.
$institution_lang = get_record_sql(
"SELECT value FROM {institution_config} ic where ic.institution= ? and ic.field = 'lang' ",
[$this->name],
IGNORE_MULTIPLE
);
$this->lang = $institution_lang->value? $institution_lang->value: 'default';
if ($this->lang != 'default') {
// The user hasn't been added yet, so we have to manually use this institution's lang
$lang = $this->lang;
}
else {
$lang = get_config('lang')? get_config('lang'): '';
}
}
We have also opened a PR in github:
https://github.com/MaharaProject/mahara/pull/7
** Affects: mahara
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1703608
Title:
Institution addUserAsMember lang logic is flawed
Status in Mahara:
New
Bug description:
The logic in charge of selecting the lang for the message does not work as expected.
The condition:
if ($lang = get_account_preference($user->id, 'lang')) {
// The user has a preset lang preference so we will use this
}
else if ($this->lang != 'default') {
// The user hasn't been added yet, so we have to manually use this institution's lang
$lang = $this->lang;
}
else {
$lang = get_user_language($user->id);
}
gets always sent in english if the site default lang is french.
To reproduce it:
You set another language than english as default language. You an institution with default lang and then you add a user (his lang preference is not setting) into this institution. He is going to receive an english message in that case and also in the case that the institution language is explicitly set to the additional lang.
That is corrected with the following:
$lang = get_account_preference($user->id, 'lang');
if ($lang == 'default') {
// The user has not a preset lang preference so we will use the institution if it has one.
$institution_lang = get_record_sql(
"SELECT value FROM {institution_config} ic where ic.institution= ? and ic.field = 'lang' ",
[$this->name],
IGNORE_MULTIPLE
);
$this->lang = $institution_lang->value? $institution_lang->value: 'default';
if ($this->lang != 'default') {
// The user hasn't been added yet, so we have to manually use this institution's lang
$lang = $this->lang;
}
else {
$lang = get_config('lang')? get_config('lang'): '';
}
}
We have also opened a PR in github:
https://github.com/MaharaProject/mahara/pull/7
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1703608/+subscriptions
Follow ups
-
[Bug 1703608] Re: Institution addUserAsMember lang logic is flawed
From: Robert Lyon, 2017-10-30
-
[Bug 1703608] A change has been merged
From: Mahara Bot, 2017-09-27
-
[Bug 1703608] Re: Institution addUserAsMember lang logic is flawed
From: Robert Lyon, 2017-09-27
-
[Bug 1703608] Re: Institution addUserAsMember lang logic is flawed
From: Nelson, 2017-07-19
-
[Bug 1703608] Re: Institution addUserAsMember lang logic is flawed
From: Kristina Hoeppner, 2017-07-19
-
[Bug 1703608] Re: Institution addUserAsMember lang logic is flawed
From: Kristina Hoeppner, 2017-07-19
-
[Bug 1703608] Re: Institution addUserAsMember lang logic is flawed
From: Cecilia Vela Gurovic, 2017-07-18
-
[Bug 1703608] A patch has been submitted for review
From: Mahara Bot, 2017-07-17
-
[Bug 1703608] Re: Institution addUserAsMember lang logic is flawed
From: Kristina Hoeppner, 2017-07-16
-
[Bug 1703608] Re: Institution addUserAsMember lang logic is flawed
From: Nelson, 2017-07-14
-
[Bug 1703608] Re: Institution addUserAsMember lang logic is flawed
From: Kristina Hoeppner, 2017-07-13