From e51917eb12de6d3bbdb07a680a06d3ce50078f0d Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Tue, 13 Feb 2007 03:08:27 +0000 Subject: [PATCH] fix for MDL-8480 external db user lang sync problem --- lib/moodlelib.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index bda1fa64b3e..0c1ed7672c5 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -2433,7 +2433,14 @@ function create_user_record($username, $password, $auth='') { $newuser->auth = (empty($auth)) ? $CFG->auth : $auth; $newuser->username = $username; update_internal_user_password($newuser, $password, false); - $newuser->lang = $CFG->lang; + + // fix for MDL-8480 + // user CFG lang for user if $newuser->lang is empty + // or $user->lang is not an installed language + $sitelangs = array_keys(get_list_of_languages()); + if (empty($newuser->lang) || !in_array($newuser->lang, $sitelangs)) { + $newuser -> lang = $CFG->lang; + } $newuser->confirmed = 1; $newuser->lastip = getremoteaddr(); $newuser->timemodified = time();