MDL-50646 admin: Use site default lang as new user's preferred lang
[moodle.git] / user / lib.php
index 797ce91..c89784f 100644 (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;