function login_destination_drupal_goto_alter in Login Destination 7
Implements hook_drupal_goto_alter().
File
- ./
login_destination.module, line 324 - Control where users are directed to, once they login
Code
function login_destination_drupal_goto_alter(&$path, &$options, &$http_response_code) {
// Note that this functionality cannot be backported to 6.x as Drupal 6 does
// not call drupal_alter for drupal_goto.
// Special case for the legal module.
// If we don't let the legal module goto it's legal agreement then the user
// cannot agree and login will just fail silently.
// The legal module will respect our destination once the user has submitted
// the legal agreement form.
// covers legal_accept module - both 'legal_accept' and 'legal_accept/'
if (strpos($path, 'legal_accept') === 0) {
return;
}
// system/tfa case
if (strpos($path, 'system/tfa') === 0) {
return;
}
// This actually may be used also by templates.
if (!isset($GLOBALS['destination'])) {
return;
}
$destination = $GLOBALS['destination'];
$path = $destination;
// Alter drupal_goto.
if (is_array($destination)) {
$path = $destination[0];
$options = array();
if (count($destination) > 1) {
$options = $destination[1];
}
}
}