You are here

function _logintoboggan_process_redirect in LoginToboggan 6

Same name and namespace in other branches
  1. 5 logintoboggan.module \_logintoboggan_process_redirect()
  2. 7 logintoboggan.module \_logintoboggan_process_redirect()

Transforms a URL fragment into a redirect array understood by drupal_goto().

Parameters

$redirect: The redirect string.

$account: The user account object associated with the redirect.

2 calls to _logintoboggan_process_redirect()
logintoboggan_user_register_submit in ./logintoboggan.module
Custom submit function for user registration form
logintoboggan_validate_email in ./logintoboggan.module
Menu callback; validate the e-mail address as a one time URL, and redirects to the user page on success.

File

./logintoboggan.module, line 1190
Logintoboggan Module

Code

function _logintoboggan_process_redirect($redirect, $account) {
  $variables = array(
    '%uid' => $account->uid,
  );
  $redirect = parse_url(urldecode(strtr($redirect, $variables)));

  // If there's a path set, override the destination parameter if necessary.
  if ($redirect['path'] && variable_get('logintoboggan_override_destination_parameter', 1)) {
    unset($_REQUEST['destination'], $_REQUEST['edit']['destination']);
  }

  // Explicitly create query and fragment elements if not present already.
  $redirect['query'] = isset($redirect['query']) ? $redirect['query'] : NULL;
  $redirect['fragment'] = isset($redirect['fragment']) ? $redirect['fragment'] : NULL;
  return $redirect;
}