The following code works for me to redirect the user back to the previous current page after he/she logs in.
<?php print l(t('Please Log in'),'/user/login', array( 'attributes' => array('title' => t('Log in page')), 'query' => drupal_get_destination())); ?>
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? )