function profile2_form_submit_handler in Profile 2 7.2
Same name and namespace in other branches
- 7 profile2.module \profile2_form_submit_handler()
Submit handler that builds and saves all profiles in the form.
See also
1 string reference to 'profile2_form_submit_handler'
- profile2_attach_form in ./
profile2.module - Attaches the profile forms of the profiles set in $form_state['profiles'].
File
- ./
profile2.module, line 898 - Support for configurable user profiles.
Code
function profile2_form_submit_handler(&$form, &$form_state) {
profile2_form_submit_build_profile($form, $form_state);
// This is needed as some submit callbacks like user_register_submit() rely on
// clean form values.
profile2_form_submit_cleanup($form, $form_state);
foreach ($form_state['profiles'] as $type => $profile) {
// During registration set the uid field of the newly created user.
if (empty($profile->uid) && isset($form_state['user']->uid)) {
$profile->uid = $form_state['user']->uid;
}
else {
// Updating an existing account, show "changed" message.
// Note that when updating there is only ever one profile in the form,
// so this message does not get duplicated.
drupal_set_message(t('The changes have been saved.'));
}
profile2_save($profile);
}
}