You are here

function account_profile_form_submit in Account Profile 6

Submit function for the user account and profile editing form.

1 string reference to 'account_profile_form_submit'
account_profile_form_alter in ./account_profile.module
Implementation of hook_form_alter().

File

./account_profile.module, line 130
Account Profile module

Code

function account_profile_form_submit($form, &$form_state) {

  // Prepare account data and values for user_save
  $account = $form_state['values']['_account'];
  $category = $form_state['values']['_category'];

  // prevent to store node values in user->data field.
  $values = $form_state['values']['account'];

  // If username has changed, update the node's name for node_save()
  // otherwise it doesn't find the old username
  $form_state['values']['name'] = $form_state['values']['account']['name'];

  // Save user data
  user_module_invoke('submit', $values, $account, $category);
  user_save($account, $values, $category);

  // Clear the page cache because pages can contain usernames and/or profile information:
  cache_clear_all();
  drupal_set_message(t('User Account ' . $form_state['values']['account']['name'] . ' has been updated.'));
  return;
}