function authcache_p13n_authcache_cookie in Authenticated User Page Caching (Authcache) 7.2
Implements hook_authcache_cookie().
Remove cache-version cookie when session is empty.
Related topics
File
- modules/
authcache_p13n/ authcache_p13n.module, line 640 - Provides methods for serving personalized content fragments.
Code
function authcache_p13n_authcache_cookie($account) {
global $user;
$cookie = array();
// See drupal_session_commit().
if (empty($user->uid) && empty($_SESSION)) {
// Make sure cookie is not set when there is no session.
$cookie['aucp13n']['present'] = FALSE;
}
elseif (authcache_p13n_session_invalidate(TRUE) || empty($_COOKIE['aucp13n'])) {
// Renew cookie if necessary.
$cookie['aucp13n']['present'] = TRUE;
$cookie['aucp13n']['value'] = base_convert(mt_rand(), 10, 36);
}
return $cookie;
}