On my site I have a private page that can only be accessed when the user is logged in. If they aren't logged in they are directed to the login page.
I want to redirect them back to that page after they've logged in
I've tried a lot of solutions already listed on here including: logindestination and logintoboggan.
Every time the person logs in they are always directed to their user page no matter what I change in logintoboggan/logindestination
I tried creating a rule but was getting a 404. I'm not sure what to put in the PHP Evaluation field in the redirect action.
I've added this to my template file
global $user;
if ($user->uid == 0){
print l("Login","user/login",array('query' => drupal_get_destination()));
}
else{
print l("Logout","user/logout",array('query' => drupal_get_destination()));
}
And then in logindestination I added
$destination = drupal_get_destination();
print $destination;
What am I doing wrong??