MDL-8487 if user language do not exist during restore use site default

This commit is contained in:
skodak
2007-02-14 09:54:08 +00:00
parent c1250d546c
commit 20c63dcf73
+9
View File
@@ -1464,6 +1464,9 @@
// Grab mnethosts keyed by wwwroot, to map to id
$mnethosts = get_records('mnethost', '', '',
'wwwroot', 'wwwroot, id');
$languages = get_list_of_languages();
foreach ($info->users as $userid) {
$rec = backup_getid($restore->backup_unique_code,"user",$userid);
$user = $rec->info;
@@ -1473,6 +1476,12 @@
$user->lang = 'mi_nt';
}
//If language does not exist here - use site default
if (!array_key_exists($user->lang, $languages)) {
$user->lang = $CFG->lang;
}
//Check if it's admin and coursecreator
$is_admin = !empty($user->roles['admin']);
$is_coursecreator = !empty($user->roles['coursecreator']);