[development] how to redirect user after login

Andrew Berry andrewberry at sentex.net
Fri Nov 21 14:57:41 UTC 2008


On 19-Nov-08, at 2:54 PM, Khalid Baheyeldin wrote:

> Check this http://drupal.org/project/login_destination

That module works well, a +1 from me.

> not when
> the user recieve a 403 error

Our users have found the customerror for 403's to be really useful by  
adding the following PHP snippet:

<?php
global $user;
if ($user->uid == 0) {
   print '<p>If your user account has access to this page, <a href="/ 
user?' . drupal_get_destination() . '">log in with your user account</ 
a>.</p>';
}
?>

That way when there's a 403 they get redirected back to the page they  
were trying to access. The above is not really "best practice", it  
should probably call l() or url() so it works when clean URL's are  
disabled.

--Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2672 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/development/attachments/20081121/8ac96e54/attachment.bin 


More information about the development mailing list