function authcache_example_user in Authenticated User Page Caching (Authcache) 6
Implementation of hook_user()
Cookies need to be reset in case user logs in under a different account
File
- modules/
authcache_example/ authcache_example.module, line 125 - authcache_example.module
Code
function authcache_example_user($op, &$edit, &$account, $category = NULL) {
// cookie expiration
$expires = ini_get('session.cookie_lifetime');
$expires = !empty($expires) && is_numeric($expires) ? time() + (int) $expires : 0;
switch ($op) {
case 'login':
setcookie('authcache_example', time(), $expires, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure') == '1');
break;
case 'logout':
setcookie('authcache_example', "", time() - 86400, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure') == '1');
break;
default:
break;
}
}