function profile_user_import_save_profile in User Import 6.4
Same name and namespace in other branches
- 8 supported/profile.inc \profile_user_import_save_profile()
- 5.2 supported/profile.inc \profile_user_import_save_profile()
- 5 supported/profile.inc \profile_user_import_save_profile()
- 6.2 supported/profile.inc \profile_user_import_save_profile()
- 7 supported/profile.inc \profile_user_import_save_profile()
- 7.2 supported/profile.inc \profile_user_import_save_profile()
1 call to profile_user_import_save_profile()
- profile_user_import_after_save in supported/
profile.inc - Implementation of hook_user_import_after_save().
File
- supported/
profile.inc, line 52
Code
function profile_user_import_save_profile($field, $uid, $value, $updated, $update_setting, &$data) {
// 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_range("SELECT value FROM {profile_values} WHERE fid = %d AND uid = %d", $field->fid, $uid, 0, 1));
user_import_profile_date($value, $field->type);
if ($updated) {
switch ($update_setting) {
case UPDATE_NONE:
return;
case UPDATE_ADD:
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", $value, $field->fid, $uid);
}
$data[$field->name] = $value;
return;
}
}
else {
if (empty($value)) {
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", $value, $field->fid, $uid);
$data[$field->name] = $value;
}
}
return;
}