--- profile.inc 2009-05-04 12:05:38.000000000 -0400 +++ profile.inc 2009-05-04 12:43:39.000000000 -0400 @@ -38,7 +38,11 @@ function profile_user_import_after_save( $data = $old_data = unserialize($account->data); foreach ($profile_fields as $field) { - profile_user_import_save_profile($field, $account->uid, $fields['profile'][$field->fid][0], $updated, $update_setting_per_module['profile'], $data); + //only update profile_value table for fields that are being imported + if (isset($fields['profile'][$field->fid])){ + profile_user_import_save_profile($field, $account->uid, $fields['profile'][$field->fid][0], $updated, $update_setting_per_module['profile']); + } + unset($data[$field->name]); } // data column in the user table needs to be updated @@ -50,8 +54,7 @@ function profile_user_import_after_save( } -function profile_user_import_save_profile($field, $uid, $value, $updated, $update_setting, &$data) { - +function profile_user_import_save_profile($field, $uid, $value, $updated, $update_setting) { // when the profile field is displayed on the registration form an empty value is automatically saved by the Profile module $exists = db_result(db_query("SELECT value FROM {profile_values} WHERE fid = %d AND uid = %d LIMIT 1", $field->fid, $uid)); @@ -65,29 +68,23 @@ function profile_user_import_save_profil if (empty($value) || (!empty($exists) && $exists != '')) return; case UPDATE_REPLACE: - if (empty($value) && $update_setting == UPDATE_REPLACE) { - db_query("DELETE FROM {profile_values} WHERE fid = %d AND uid = %d", $field->fid, $uid); - unset($data[$field->name]); return; } - if ((empty($exists) && $exists != '') || $exists === FALSE) { - db_query("INSERT INTO {profile_values} (fid,uid,value) VALUES(%d,%d,'%s')", $field->fid, $uid, $value); } else { db_query("UPDATE {profile_values} SET value = '%s' WHERE fid = %d AND uid = %d LIMIT 1", $value, $field->fid, $uid); } - $data[$field->name] = $value; return; } } else { - + //the account has just been created if (empty($value)) return; if ((empty($exists) && $exists != '') || $exists === FALSE) { @@ -95,7 +92,6 @@ function profile_user_import_save_profil } else { db_query("UPDATE {profile_values} SET value = '%s' WHERE fid = %d AND uid = %d LIMIT 1", $value, $field->fid, $uid); - $data[$field->name] = $value; } }