Scenario: A user chooses to view a node without being logged in. I want my website to redirect the user to a login page, and then after logging in, return to the requested node. If the user enters the wrong login info at first, I still want them to be able to view the requested node after they provide the correct info.
I have both a login block on the very first page of the site, and a separate login page (a node) which is viewable to users who have not logged in.
I am very new to Drupal, but have implemented this functionality before without Drupal (using just php). There's a few things that I'm trying to get under my control.
1) Being able to designate a page to redirect to when the user tries to view a node and is not logged in. For instance, I would like the user to go to /login_page&destination=/user/node/### provided I have my separate login_page (cck node type with input set as PHP) created. I have tried to implement this by editing page.tpl.php for my respective theme (by setting a condition for if (!$user->uid) and using the traditional header(Location: ...) PHP redirect method. This does not seem to work however, as any page I try to access (existing or not) while I am not logged in redirects me to what I am calling home. Any ideas how to override this incorrect redirection?