1

I am using Drupal-7 and I have installed login redirect module to redirect my page after login.

I read that this module allows redirect towards non-Drupal location. So, does the Login redirect module is only for to redirect non-Drupal location? Can we redirect to the internal path thru login redirect module?

If this module allows internal path redirection as well, then what to write in Parameter Name?

For example, if we want to redirect it to google after login, then we have to write in parameter name like this: user/login?destination=http://www.google.com

But, I am not sure about internal path. Can any one please guide me on that?

Thank You!

1

Short answer is no, Login Redirect is set up to only use external addresses.

Looking at the module code, you'll see this function

function login_redirect_perform_redirect($destination) {
  drupal_goto($destination, array('external' => TRUE));
}

that external flag is hard coded, and means as long as you use this module for redirecting, the redirect will always think it's pointing to an external site.

If you want to redirect to an internal link, there are other modules out there you can try. Drupal has a fairly good rundown of them. Personally I favor creating a rule to do this.

=======EDIT=========

To do this with rules, you first need to download and enable rules if you haven't done so yet (make sure you enable the ui as well).

Then swing over to admin/config/workflow/rules, add a new rule (top of page). This will bring you to the first add page where you will name the rule and select "React on event," you will want to set this as "user has logged in"

Hit save and you'll see the "edit rule" page, here there are three sections, events, conditions, and actions. The event should be pre-populated. If you want, you can add conditions, like if a user has a specific role, but you don't need to. For action, you'r gonna want to select "System/page redirect." The url value takes both drupal paths, aliases, and external urls, so in this case if the url your looking to redirect to is at yoursite/contact-us page, you should be able to just put "contact-us" in the url value box. That should get you where you want to be. It's a bit more in-depth than some of the other modules out there, but I personally feel the flexibility with internal vs external and conditions make it a really good choice for this sort of thing.

  • Also, you mentioned about Rule. Can you please explain me how can we accomplish this with Rule? For example, If I wanted to redirect users to contact-us page after login. – Vidushi Feb 11 '15 at 17:05
  • Wowwww .. Awesome .. Thank you soooo muchhh #Jence. Rule works like a charm. I also have also added user specific role. I was trying to accomplish this since long. But didn't know how to do it with Rule. Thank you so much!! You are such a savior for me. – Vidushi Feb 11 '15 at 17:40
  • Can we also hide user profile edit section from some users(for example user role=student) by adding Rule? – Vidushi Feb 11 '15 at 17:48
  • @Vidushi Unfortunately I don't think you can do that with rules. Rules is a workflow thing, so it needs an action to work against, what your describing sounds like a permissions thing. I don't know if it will work for user profiles or not, but you might want to take a look at field permissions to see if you can disallow user editing on user fields with that (drupal.org/project/field_permissions) again, i'm not sure if that will work or not, but might be worth a try. – Jance Feb 11 '15 at 17:57
2

For internal path you can also specify user/login?destination="page name here"

will redirect to your internal path

For example you have a page called "contact-us" specify user/login?destination="contact-us" will automatically redirect to that page after login

Go through the README.TXT in login_destination module to get more info

hope this helps

  • OP was using login redirect, which is a different module than login destination. – Jance Feb 11 '15 at 16:45

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.