I can't find a "setting" for this.

In my case, destination param passed via query string is not being observed.

Anybody solve this?

Mike

Comments

chrisJTAM’s picture

Having the same problem

gemini’s picture

Don't see either... I thought I was the only one - drove me nuts :)

daveLA’s picture

Same problem here as well. Any chance of an update or fix for this?

davidwhthomas’s picture

While you can set a PHP snippet to do this also, you need to set all the code to check the true and false conditions

Preserving the destination should just be a global default setting (imho)

the fix is to insert this code (without the php tags) into the start of:

modules/login_destination/login_destination.module
(around line 120)
function login_destination_apply_redirect()

<?php
  if($_GET['destination']){
    return FALSE; //destination already set
  }
?>

so that the full function becomes:

<?php
/**
 * A helper function to determine whether redirection should happen.
 *
 * @return bool TRUE - apply redirect, FALSE - not to apply redirect.
 */
function login_destination_apply_redirect() {
  $result = FALSE;
  if($_GET['destination']){
    return FALSE; //destination already set
  }
  $mode = variable_get('ld_condition_type', LOGIN_COND_ALWAYS);
  if (LOGIN_COND_ALWAYS == $mode) {
    $result = TRUE;
  } else {
    $cond = variable_get('ld_condition_snippet', '');
    if (LOGIN_COND_PAGES == $mode) {
      $paths = split("[\n\r]", $cond);
      $result = in_array($_GET['q'], $paths);
      if (!$result) {
        $result = in_array(drupal_get_path_alias($_GET['q']), $paths);
      }
    } elseif (LOGIN_COND_SNIPPET == $mode) {
      $destination = variable_get('ld_url_destination', 'user');
      $result = drupal_eval('<?php '. $cond. ' ?>');
    }
  }

  return $result;
}
?>

This just returns false if the destination is set in the URL meaning the redirection is not applied.

or maybe:

<?php
  if(isset($_REQUEST['destination'])){
    return $result; //destination already set
  }
?>

To check the $_POST array also for a posted destination and use the isset() function for checking an array element value while using the $result variable set in the function context as the return value;

hth.

DT

wiredescape’s picture

Title: "Preserve Desination" » "Preserve Destination"

Changed title to correct typo.
From "Preserve Desination" to "Preserve Destination".
Makes finding in search easier...

ddrozdik’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Version 5 of the module is not supported anymore.