You are here

function authcache_usercookie_authcache_cookie in Authenticated User Page Caching (Authcache) 7.2

Implements hook_authcache_cookie().

File

examples/authcache_usercookie/authcache_usercookie.module, line 12
Example authcache module passing name and profile-link of logged in users to theming layer via cookies.

Code

function authcache_usercookie_authcache_cookie($account) {
  $authenticated = $account->uid;
  $enabled = authcache_account_allows_caching($account);
  $present = $authenticated && $enabled;
  $cookies['aceuser']['present'] = $present;
  if ($present) {
    $cookies['aceuser']['value'] = $account->name;
  }
  return $cookies;
}