Skip to content

Commit

Permalink
MDL-23037 Improved handling of the language preferred by remote users
Browse files Browse the repository at this point in the history
Strips _utf8 suffix for remote users roaming from Moodle 1.x sites.
Checks that the preferred language is actually installed, uses the site
default otherwise.
  • Loading branch information
mudrd8mz committed Jul 1, 2010
1 parent 5db29f4 commit 67c1d98
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions auth/mnet/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,16 @@ function confirm_mnet_session($token, $remotepeer) {
$remoteuser->auth = 'mnet';
$remoteuser->wwwroot = $remotepeer->wwwroot;

// the user may roam from Moodle 1.x where lang has _utf8 suffix
// also, make sure that the lang is actually installed, otherwise set site default
$remoteuser->lang = clean_param(str_replace('_utf8', '', $remoteuser->lang), PARAM_LANG);
if (empty($remoteuser->lang)) {
if (!empty($CFG->lang)) {
$remoteuser->lang = $CFG->lang;
} else {
$remoteuser->lang = 'en';
}
}
$firsttime = false;

// get the local record for the remote user
Expand Down

0 comments on commit 67c1d98

Please sign in to comment.