Mnet: Users mnethostid now defaults to the admin user's mnethostid: MDL-8253

This commit is contained in:
donal72 2007-01-23 22:03:48 +00:00
parent 2541d297cf
commit 3a1edc56f4

View File

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