Closed (works as designed)
Project:
User Import
Version:
6.x-2.3
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 May 2010 at 00:34 UTC
Updated:
28 Jun 2010 at 23:52 UTC
Jump to comment: Most recent
Comments
Comment #1
JasonMR commentedMaybe we should remove the "update" feature, until this is fixed?
Comment #2
robert castelo commentedWorks as intended, you replaced the existing data.
If you want to add data select 'Add Data'.
If you want to only replace data in a particular field, you could delete the profile field, thus deleting existing data, then use 'Add Data'.
Test first!
Comment #3
robert castelo commented* I meant delete the field, then recreate it, then Add Data.
Comment #4
JasonMR commentedNope, I've tried this on a demo-site and if I have multiple profile fields and try to update just one field using "replace data", it updates all fields, replacing selected field with provided data, and all other fields with default data.
Is this "by design"? Looking at the code I don't think so.
Comment #5
JasonMR commentedIf you need more info, please let me know.
Comment #6
JasonMR commentedBy the way, add data does nothing, as no field is defined.
Comment #7
JasonMR commented*sorry, didn't realise I can actually edit posts
Comment #8
OliverColeman commentedThis may be due to the way the Profile module works: it doesn't allow updating a single field, you have to retrieve all the field values into an array (for the relevant category if desired), edit the desired one, then save it again (either using profile_save_profile or user_save). Or you could make your own version of profile_save_profile that is more flexible.
Comment #9
jvieille commentedThis is a bug actually.
The function profile_user_import_after_save processes any defined profile fields by setting imported fields, resetttings any others.
A simple check solves this issue :
function profile_user_import_after_save($settings, $account, $password, $fields, $updated, $update_setting_per_module) {
// get all fields
$profile_fields = profile_get_fields();
$data = $old_data = unserialize($account->data);
foreach ($profile_fields as $field) {
+ 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'], $data);
+ }
}
// data column in the user table needs to be updated
if ($data != $old_data) {
db_query("UPDATE {users} SET data = '%s' WHERE uid = %d", serialize($data), $account->uid);
}
return;
}