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.
This commit is contained in:
David Mudrák 2015-06-19 13:17:52 +02:00
parent f4bfbd5aa2
commit 7e670032bf

View file

@ -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;