function profile_form_user_register_form_submit in Profile 2 8
Extra form submission handler for the user registration form.
1 string reference to 'profile_form_user_register_form_submit'
- profile_form_user_register_form_alter in ./
profile.module - Implements hook_form_FORM_ID_alter().
File
- ./
profile.module, line 213 - Support for configurable user profiles.
Code
function profile_form_user_register_form_submit(array &$form, FormStateInterface $form_state) {
$account = $form_state
->getFormObject()
->getEntity();
$profiles = $form_state
->get('profiles');
if (!empty($profiles)) {
foreach ($profiles as $bundle => $entity) {
$entity
->setOwnerId($account
->id());
$entity
->setActive(TRUE);
$entity
->save();
}
}
}