diff --git a/user/lib.php b/user/lib.php
index <HASH>..<HASH> 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;
MDL-<I> admin: Use site default lang as new user's preferred lang

As a result of MDL-<I>, 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.