diff --git a/auth/mnet/auth.php b/auth/mnet/auth.php index 2ee6098d079a2..2eb20c960e508 100644 --- a/auth/mnet/auth.php +++ b/auth/mnet/auth.php @@ -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