You are here

function authcache_example_block_form_submit in Authenticated User Page Caching (Authcache) 6

Same name and namespace in other branches
  1. 7 modules/authcache_example/authcache_example.module \authcache_example_block_form_submit()

User updated their block

File

modules/authcache_example/authcache_example.module, line 50
authcache_example.module

Code

function authcache_example_block_form_submit($form, &$form_state) {
  $account = $form['#parameters'][2];
  db_query("INSERT INTO {authcache_example} (uid,block_text) VALUES (%d, '%s') ON DUPLICATE KEY UPDATE block_text='%s'", $account->uid, $form_state['values']['block_text'], $form_state['values']['block_text']);

  // Invalidate browser cache by modify our cache cookie time
  setcookie('authcache_example', time(), 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure') == '1');
  drupal_set_message(t("Your block has been updated."));
}