You are here

function logintoboggan_destination in LoginToboggan 5

Same name and namespace in other branches
  1. 6 logintoboggan.module \logintoboggan_destination()
1 call to logintoboggan_destination()
logintoboggan_form_alter in ./logintoboggan.module
Implementation of hook_form_alter()

File

./logintoboggan.module, line 749
Logintoboggan Module

Code

function logintoboggan_destination() {

  // Drupal has reset $_GET[q], so we need a workaround.
  if ($internal_path = substr(request_uri(), strlen(base_path()))) {

    // Clean URLs enabled, just pass destination through.
    if (variable_get('clean_url', 0)) {
      $_REQUEST['destination'] = $internal_path;
    }
    else {
      $internal_path = parse_url($internal_path);
      $queryarray = explode('&', $internal_path['query']);
      $path = str_replace('q=', '', $queryarray[0]);
      unset($queryarray[0]);
      $query = !empty($queryarray) ? '?' . implode('&', $queryarray) : '';
      $_REQUEST['destination'] = $path . $query;
    }
  }
  else {
    $_REQUEST['destination'] = variable_get('site_frontpage', 'node');
  }
}