function persistent_login_init in Persistent Login 7
Same name and namespace in other branches
- 5 persistent_login.module \persistent_login_init()
- 6 persistent_login.module \persistent_login_init()
Implements hook_init(). Before the menu system takes control, perform a Persistent Login if appropriate.
File
- ./
persistent_login.module, line 51 - Provide a "Remember Me" checkbox in the login form.
Code
function persistent_login_init() {
global $user;
// If the user is logged in only via Persistent Login, then don't let them
// visit restricted pages.
if (isset($_SESSION['persistent_login_login']) && _persistent_login_match($_GET['q'])) {
$_SESSION['persistent_login_default_user'] = $user->name;
$user = user_load(0);
unset($_SESSION['persistent_login_check']);
unset($_SESSION['persistent_login_login']);
$_SESSION['persistent_login_reauth'] = TRUE;
unset($_GET['destination']);
drupal_set_message(t('Please verify your username and password to access this page.'), 'error');
drupal_goto('user/login', array(
'query' => drupal_get_destination(),
));
}
}