login destination redirect to previous page adding # The following code works for me to redirect the user back to the previous current page after he/she logs in.

 &lt;?php  
    print l(t('Please Log in'),'/user/login', array(
    'attributes' =&gt; array('title' =&gt; t('Log in page')),
    'query' =&gt; drupal_get_destination()));
    ?&gt;


However, how can I add # to the previous current page?

For example, if the user was on /node/1 and go to the login page.
Then How can I redirect this user to /node/1#article_1 ?

(How can I add this #article_1? )
This can be done via

&lt;?php  
  print l(t('Please Log in'),'/user/login', array(
    'attributes' =&gt; array('title' =&gt; t('Log in page')),
    'query' =&gt; drupal_get_destination(),
    'fragment' =&gt; 'article_1'));
?&gt;