How to add destination to URL in Drupal

tags: Drupal   php snippets  
drupal tags: navigation   user interaction  

Ever had the need to redirect your users to a certain page after they perform a particular task (ie: after they are invited to register to the site)?

Doing it is simple:

just translate the link in your PHPTemplate content-type file (es: node.tpl.php) from:
http://www.mywebsite.com/user/register

to:
http://www.mywebsite.com/user/register?destination=/node/<?php print $nid; ?>

and the visitor will be redirected to the node from where he was asked to register. Kust tweak the link and the redirection target page to suit your needs ;)


Similar:

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h2> <h3> <h4> <img> <hr>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
Are you human (question to prevent spam)?
Twitter
Add to Technorati Favorites

Featured:

Archives

March 2010
SunMonTueWedThuFriSat
123456
78910111213
14151617181920
21222324252627
28293031
PureDivs Drupal Themes Conversions