You are here

function _views_bulk_operations_profile_action_save in Views Bulk Operations (VBO) 6

Same name and namespace in other branches
  1. 6.3 profile.action.inc \_views_bulk_operations_profile_action_save()
1 call to _views_bulk_operations_profile_action_save()
views_bulk_operations_profile_action in actions/profile.action.inc

File

actions/profile.action.inc, line 105

Code

function _views_bulk_operations_profile_action_save(&$edit, &$user, $category, $register = FALSE) {
  $result = _profile_get_fields($category, $register);
  while ($field = db_fetch_object($result)) {
    if (!$edit[$field->name . '_check']) {
      continue;
    }

    // skip if the user didn't check that field
    if (_profile_field_serialize($field->type)) {
      $edit[$field->name] = serialize($edit[$field->name]);
    }
    db_query("DELETE FROM {profile_values} WHERE fid = %d AND uid = %d", $field->fid, $user->uid);
    db_query("INSERT INTO {profile_values} (fid, uid, value) VALUES (%d, %d, '%s')", $field->fid, $user->uid, $edit[$field->name]);

    // Mark field as handled (prevents saving to user->data).
    $edit[$field->name] = NULL;
  }
}