Last active
September 7, 2016 16:48
-
-
Save colepacak/f73ef9118ffb0ac4a7af0956081ea369 to your computer and use it in GitHub Desktop.
User - Redirect on user_register_submit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/modules/user/user.module b/modules/user/user.module | |
index b239799..acb57b6 100644 | |
--- a/modules/user/user.module | |
+++ b/modules/user/user.module | |
@@ -3877,16 +3877,17 @@ function user_register_submit($form, &$form_state) { | |
// New administrative account without notification. | |
$uri = entity_uri('user', $account); | |
+ | |
if ($admin && !$notify) { | |
drupal_set_message(t('Created a new user account for <a href="@url">%name</a>. No e-mail has been sent.', array('@url' => url($uri['path'], $uri['options']), '%name' => $account->name))); | |
} | |
// No e-mail verification required; log in user immediately. | |
elseif (!$admin && !variable_get('user_email_verification', TRUE) && $account->status) { | |
+ $original_redirect = $form_state['redirect']; | |
_user_mail_notify('register_no_approval_required', $account); | |
$form_state['uid'] = $account->uid; | |
user_login_submit(array(), $form_state); | |
- drupal_set_message(t('Registration successful. You are now logged in.')); | |
- $form_state['redirect'] = ''; | |
+ $form_state['redirect'] = $original_redirect; | |
} | |
// No administrator approval required. | |
elseif ($account->status || $notify) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment