You are here

function profile_save_profile in Drupal 5

Same name and namespace in other branches
  1. 4 modules/profile.module \profile_save_profile()
  2. 6 modules/profile/profile.module \profile_save_profile()
  3. 7 modules/profile/profile.module \profile_save_profile()
1 call to profile_save_profile()
profile_user in modules/profile/profile.module
Implementation of hook_user().

File

modules/profile/profile.module, line 535
Support for configurable user profiles.

Code

function profile_save_profile(&$edit, &$user, $category, $register = FALSE) {
  $result = _profile_get_fields($category, $register);
  while ($field = db_fetch_object($result)) {
    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;
  }
}