1

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

2

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)
1
  • I hadn't tried that but I have now, and it works a treat. Thank you
    – Andy
    Apr 20, 2013 at 20:31

Your Answer

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

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