function login_destination_apply_redirect in Login Destination 5
Same name and namespace in other branches
- 6 login_destination.module \login_destination_apply_redirect()
A helper function to determine whether redirection should happen.
Return value
bool TRUE - apply redirect, FALSE - not to apply redirect.
1 call to login_destination_apply_redirect()
- login_destination_form_alter in ./
login_destination.module - Implementation of hook_form_alter().
File
- ./
login_destination.module, line 144 - Controls which URL users will be redirected upon login.
Code
function login_destination_apply_redirect() {
if (!empty($_GET['destination']) && variable_get('ld_destination', TRUE)) {
return FALSE;
}
$mode = variable_get('ld_condition_type', LOGIN_COND_ALWAYS);
if (LOGIN_COND_ALWAYS == $mode) {
return TRUE;
}
else {
$cond = variable_get('ld_condition_snippet', '');
if (LOGIN_COND_PAGES == $mode) {
$paths = split("[\n\r]", $cond);
return in_array($_GET['q'], $paths);
}
elseif (LOGIN_COND_SNIPPET == $mode) {
$destination = variable_get('ld_url_destination', 'user');
return drupal_eval('<?php ' . $cond . ' ?>');
}
}
return FALSE;
}