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

Form submission handler for user_profile_form().

See also

user_profile_form_validate()

File

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

Code

function user_profile_form_submit($form, &$form_state) {
  $account = $form_state['user'];
  // Remove unneeded values.
  form_state_values_clean($form_state);

  // Convert checkbox values to an unindexed list.
  $form_state['values']['roles'] = array_keys(array_filter($form_state['values']['roles']));

  entity_form_submit_build_entity('user', $account, $form, $form_state);
  $account->save();
  $form_state['values']['uid'] = $account->uid;

  if (strlen(trim($form_state['values']['pass'])) > 0) {
    // Remove the password reset tag since a new password was saved.
    unset($_SESSION['pass_reset_' . $account->uid]);
  }

  // Redirect to view the user account.
  $form_state['redirect'] = 'user/' . $account->uid;

  backdrop_set_message(t('The changes have been saved.'));
}