]> git.mjollnir.org Git - moodle.git/commitdiff
Mnet: Users mnethostid now defaults to the admin user's mnethostid: MDL-8253
authordonal72 <donal72>
Tue, 23 Jan 2007 22:03:48 +0000 (22:03 +0000)
committerdonal72 <donal72>
Tue, 23 Jan 2007 22:03:48 +0000 (22:03 +0000)
admin/uploaduser.php

index a896e37f0b5941531a2eec2fdad0e9ff1daff896..34cbb77b9b8966408562c2da1914df28526e1818 100755 (executable)
@@ -82,7 +82,8 @@ if ($um->preprocess_files() && confirm_sesskey()) {
             "firstname" => 1,
             "lastname" => 1,
             "email" => 1);
-    $optionalDefaults = array("institution" => 1,
+    $optionalDefaults = array("mnethostid" => 1,
+            "institution" => 1,
             "department" => 1,
             "city" => 1,
             "country" => 1,
@@ -236,7 +237,7 @@ if ($um->preprocess_files() && confirm_sesskey()) {
                     // an old record instead
                     if ($allowrenames && !empty($user->oldusername) ) {
                         $user->oldusername = moodle_strtolower($user->oldusername);
-                        if ($olduser = get_record('user', 'username', $user->oldusername, 'mnethostid', $CFG->mnet_localhost_id)) {
+                        if ($olduser = get_record('user', 'username', $user->oldusername, 'mnethostid', $user->mnethostid)) {
                             if (set_field('user', 'username', $user->username, 'username', $user->oldusername)) {
                                 notify(get_string('userrenamed', 'admin') . " : $user->oldusername $user->username");
                                 $renames++;
@@ -252,7 +253,7 @@ if ($um->preprocess_files() && confirm_sesskey()) {
                         }
                     }
 
-                    if ($olduser = get_record("user", "username", $username, "mnethostid", $CFG->mnet_localhost_id)) {
+                    if ($olduser = get_record("user", "username", $username, "mnethostid", $user->mnethostid)) {
                         if ($updateaccounts) {
                             // Record is being updated
                             $user->id = $olduser->id;