Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.457 diff -u -F^f -r1.457 common.inc --- includes/common.inc 6 Jul 2005 14:20:11 -0000 1.457 +++ includes/common.inc 6 Jul 2005 18:00:40 -0000 @@ -133,20 +133,26 @@ function drupal_get_headers() { /** * Prepare a destination query string for use in combination with - * drupal_goto(). Used to direct the user back to the referring page - * after completing a form. + * drupal_goto(). Used to direct the user back to the referring page after + * completing a form. If the destination was perviously set that destination is + * used instead of the current page. * * @see drupal_goto() */ function drupal_get_destination() { - $destination[] = $_GET['q']; - $params = array('page', 'sort', 'order'); - foreach ($params as $param) { - if (isset($_GET[$param])) { - $destination[] = "$param=". $_GET[$param]; + if ($_REQUEST['destination']) { + return 'destination='. urlencode($_REQUEST['destination']); + } + else { + $destination[] = $_GET['q']; + $params = array('page', 'sort', 'order'); + foreach ($params as $param) { + if (isset($_GET[$param])) { + $destination[] = "$param=". $_GET[$param]; + } } + return 'destination='. urlencode(implode('&', $destination)); } - return 'destination='. urlencode(implode('&', $destination)); } /**