I thought I could use the following code:
<a href="user/login?destination=<?php print token_replace('[current-page:url]'); ?>a link</a>
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
mysite/user/login?destination=the url of the page I was on
but when I login I am still redirected to mysite/users/mymysite/users/my
user name.