You are here

function authcache_form_comment_form_alter in Authenticated User Page Caching (Authcache) 7.2

Same name and namespace in other branches
  1. 7 authcache.module \authcache_form_comment_form_alter()

Implements hook_form_BASE_FORM_ID_alter().

Related topics

File

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

Code

function authcache_form_comment_form_alter(&$form, &$form_state) {
  global $user;

  // Author name is tainted when displaying the comment form for new comments.
  // This is not the case when comments are edited though.
  if ($user->uid && authcache_page_is_cacheable() && !$form_state['comment']->cid) {
    $message = t('User name on comment form. Enable Authcache Comment module or implement custom code capable of retrieving/removing the user name.');
    if (isset($form['author']['name']['#type']) && $form['author']['name']['#type'] === 'value') {
      authcache_element_suspect($form['author']['name'], $message);
    }
    if (isset($form['author']['_author'])) {
      authcache_element_suspect($form['author']['_author'], $message);
    }
  }
}