You are here

function authcache_example_user_login in Authenticated User Page Caching (Authcache) 7

Implementation of hook_user_login()

Cookies need to be reset in case user logs in under a different account

File

modules/authcache_example/authcache_example.module, line 179
authcache_example.module

Code

function authcache_example_user_login(&$edit, &$account) {

  // cookie expiration
  $expires = ini_get('session.cookie_lifetime');
  $expires = !empty($expires) && is_numeric($expires) ? REQUEST_TIME + (int) $expires : 0;
  setcookie('authcache_example', REQUEST_TIME, $expires, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure') == '1');
}