You are here

function authcache_form_submit in Authenticated User Page Caching (Authcache) 7

Same name and namespace in other branches
  1. 6 authcache.module \authcache_form_submit()

Generic form submit handler.

Set nid cookie for cache invalidation (e.g., poll node)

1 string reference to 'authcache_form_submit'
authcache_form_alter in ./authcache.module
Implements hook_form_alter(),

File

./authcache.module, line 368
Authenticated User Page Caching (and anonymous users, too!)

Code

function authcache_form_submit(&$form, &$form_state) {
  $nid = FALSE;
  if (isset($form['#node']) && $form['#node']->type == 'poll') {
    $nid = $form['#node']->nid;
  }
  if (isset($form['#nid'])) {
    $nid = $form['#nid'];
  }
  if ($nid) {
    setcookie('nid' . $nid, REQUEST_TIME, 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure') == '1');
  }
}