From 7e670032bf795aaa446c18b1a4fb79ba24fc112a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Fri, 19 Jun 2015 13:17:52 +0200 Subject: [PATCH] MDL-50646 admin: Use site default lang as new user's preferred lang As a result of MDL-49632, the preferred language is no longer part of the "Add a new user" form. So the lang property is not passed to the user_create_user() when creating a new user and the value always falls back to "en" (which is the default defined in the database for this column). This patch makes sure that the site default language is used in such case. --- user/lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/user/lib.php b/user/lib.php index 797ce919436..c89784fac3e 100644 --- a/user/lib.php +++ b/user/lib.php @@ -88,6 +88,9 @@ function user_create_user($user, $updatepassword = true, $triggerevent = true) { if (!isset($user->trackforums)) { $user->trackforums = $CFG->defaultpreference_trackforums; } + if (!isset($user->lang)) { + $user->lang = $CFG->lang; + } $user->timecreated = time(); $user->timemodified = $user->timecreated;