Why doesn't my token redirect to the previous url? I thought I could use the following code:

&lt;a href="user/login?destination=&lt;?php print token_replace('[current-page:url]'); ?&gt;a link&lt;/a&gt;


to redirect users to the page they were on after log in, but it doesn't seem to work.

I can see the correct url on the login page, e.g.:


  mysite/user/login?destination=the url of the page I was on


but when I login I am still redirected to mysite/users/my user name.
If you want to Redirect to previous drupal page after login, you can try this. 

print l("Login","user/login",array('query' =&gt; drupal_get_destination()));


see drupal_get_destination