I have a lightbox pop up when a link is clicked to sign up for the site but, after signing up i don't want them to redirect to their user profile page, I need them to stay on the same exact page. Is this possible?

I tried login destination but that feature only works for the login not registration.

  • What module shows the Lightbox pop-up with the login link? – kiamlaluno Jul 12 '11 at 17:26
  • im using hardcoded modal plugin called leanModal. its just a lightweight modal that will show the register form in it – delboud Jul 13 '11 at 0:49

You could also use the Rules module.

| improve this answer | |
  • I have that installed and couldn't seem to get it to make the user stay on the same page after actually making a new account, you have an idea how I can achieve this? – delboud Jul 13 '11 at 0:52

Try the LoginToboggan module. It has alot more features and community support than login destination module

| improve this answer | |
  • I have it installed but doesn't do what I need it to do. – delboud Jul 12 '11 at 15:05
  • Thanks for the update, this Drdupal 6 or 7? – iStryker Jul 12 '11 at 15:10
  • This is drupal 6 – delboud Jul 13 '11 at 0:47

Cleanest way is probably to just write a little module. In it, use hook_user() to change the destination URL after login:

 * Implements hook_user().
function mymodule_user($op, &$edit, &$account, $category = NULL) {
  switch ($op) {
    case 'register':
      // set the redirect url to <front>
      $_REQUEST['destination'] = '<front>';
      // OR, uncomment the following to disable redirecting completely:
      // unset($_REQUEST['destination']);
| improve this answer | |

If you're trying to do this in your own custom module in Drupal 7:

function mymodulename_form_user_register_form_alter(){
    $_REQUEST['destination'] = 'anywhere_you_want_to_go_to';

hook_form_user_register_form_alter() always runs on the registration form. Change mymodulename to your module and make sure it's on.

The second line is the line that redirects on submit (if it validates). I don't know of any way to not redirect, but you can redirect to the page you're redirecting away from for the same result. Change the "anywhere_you_want_to_go_to" string to the page you want to go to. eg. "user/register" or "<front>".

| improve this answer | |
  • The OP is asking for a way to avoid the users are redirected to another page once they submitted the registration form. – kiamlaluno Jan 29 '13 at 2:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.