function persistent_login_init in Persistent Login 6
Same name and namespace in other branches
- 5 persistent_login.module \persistent_login_init()
- 7 persistent_login.module \persistent_login_init()
Implementation of hook_init(). Before the menu system takes control, perform a Persistent Login if appropriate.
File
- ./
persistent_login.module, line 46 - 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(array(
'uid' => 0,
));
unset($_SESSION['persistent_login_check']);
unset($_SESSION['persistent_login_login']);
$_SESSION['persistent_login_reauth'] = TRUE;
unset($_REQUEST['destination']);
drupal_set_message(t('Please verify your username and password to access this page.'), 'error');
drupal_goto('user/login', drupal_get_destination());
}
}