function user_registrationpassword_form_user_register_submit in User registration password 7
Same name and namespace in other branches
- 8 user_registrationpassword.module \user_registrationpassword_form_user_register_submit()
- 6 user_registrationpassword.module \user_registrationpassword_form_user_register_submit()
Implements submission handler for the user registration form.
See also
user_registrationpassword_form_user_register_form_alter()
2 string references to 'user_registrationpassword_form_user_register_submit'
- UserRegistrationPasswordUserRegisterFormTestCase::testUserRegisterFormCompatibility in tests/
user_registrationpassword_user_register_form.test - Implements testUserRegisterFormCompatibility().
- user_registrationpassword_form_user_register_form_alter in ./
user_registrationpassword.module - Implements hook_form_FORM_ID_alter().
File
- ./
user_registrationpassword.module, line 274 - Enables password creation on registration form.
Code
function user_registrationpassword_form_user_register_submit(&$form, &$form_state) {
// Define the message we need to remove.
// Yes, this throws a code style error, but this is in core.
// See user.module, that string contains a <br />.
$message = t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.<br />In the meantime, a welcome message with further instructions has been sent to your e-mail address.');
// Unset all messages that contain the $message.
foreach ($_SESSION['messages']['status'] as $status => $statusmessage) {
// Test for core message (we need to replace).
if ($message == $statusmessage) {
// And unset it if we find it.
unset($_SESSION['messages']['status'][$status]);
}
}
$_SESSION['messages']['status'] = array_values($_SESSION['messages']['status']);
// Notify the user.
$account = $form_state['user'];
$params['account'] = $account;
$mail = drupal_mail('user_registrationpassword', 'register', $account->mail, user_preferred_language($account), $params);
// Set succes message and redirect to the front page.
drupal_set_message(t('A welcome message with further instructions has been sent to your e-mail address.'));
}