Thank you very much for a fix for this issue, Nelson. Cecilia, can you please pull the patch into Gerrit and ensure that Nelson remains the author?
Nelson, we don't use Github pull requests as Github is only a mirror. If you want to get future changes into the Mahara code review system directly, you can find information on how to set up the connection to Gerrit at https://wiki.mahara.org/wiki/Developer_Area/Contributing_Code ** Changed in: mahara Importance: Undecided => Medium ** Changed in: mahara Milestone: None => 17.10.0 ** Changed in: mahara Assignee: (unassigned) => Cecilia Vela Gurovic (ceciliavg) -- 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 _______________________________________________ Mailing list: https://launchpad.net/~mahara-contributors Post to : [email protected] Unsubscribe : https://launchpad.net/~mahara-contributors More help : https://help.launchpad.net/ListHelp

