0

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? )

1 Answer 1

1

This can be done via

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.