6.x user.pages.inc user_profile_form_submit($form, &$form_state)
7.x user.pages.inc user_profile_form_submit($form, &$form_state)

Form submission handler for user_profile_form().

See also


1 string reference to 'user_profile_form_submit'
user_profile_form in modules/user/user.pages.inc
Form builder; edit a user account or one of their profile categories.


modules/user/user.pages.inc, line 343
User page callback file for the user module.


function user_profile_form_submit($form, &$form_state) {
  $account = $form_state['user'];
  $category = $form['#user_category'];

  // Remove unneeded values.

  // Before updating the account entity, keep an unchanged copy for use with
  // user_save() later. This is necessary for modules implementing the user
  // hooks to be able to react on changes by comparing the values of $account
  // and $edit.
  $account_unchanged = clone $account;
  entity_form_submit_build_entity('user', $account, $form, $form_state);

  // Populate $edit with the properties of $account, which have been edited on
  // this form by taking over all values, which appear in the form values too.
  $edit = array_intersect_key((array) $account, $form_state['values']);
  user_save($account_unchanged, $edit, $category);
  $form_state['values']['uid'] = $account->uid;
  if ($category == 'account' && !empty($edit['pass'])) {

    // Remove the password reset tag since a new password was saved.
    unset($_SESSION['pass_reset_' . $account->uid]);

  // Clear the page cache because pages can contain usernames and/or profile information:
  drupal_set_message(t('The changes have been saved.'));