I would like to redirect my users to the login page on certain pages when they are not logged in. I have created a custom template for my login page, I don't know if that makes a difference, but I would like to pass two bits of information to the page in a way that the user can't see them.

I would like to pass a message that should be displayed on the login page and also the URL that the user should be directed to after login. What is the easiest and most clean way of doing this please?

1 Answer 1


Have you tried rules module. You can trigger custom action on some event. What you need to do :

  1. create an event "when the node being viwed"
  2. create a condition "when node is equal to some node"
  3. Fire a action "redirect to login page"
  4. Fire another action "show a message"(this is set drupal_set_message for you)
  • I hadn't tried that but I have now, and it works a treat. Thank you
    – Andy
    Commented Apr 20, 2013 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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