You are here

function authcache_preprocess_comment in Authenticated User Page Caching (Authcache) 6

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

Process comment template variables

Replace "new" marker with empty span containing timestamp info Add "edit" uid span for JS phase

See also

comment.module

File

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

Code

function authcache_preprocess_comment(&$variables) {

  // Will use Ajax to determine whether to display "new" marker for user
  if ($variables['is_page_authcache']) {
    $variables['new'] = '<span class="authcache-comment-new" data-timestamp="' . $variables['comment']->timestamp . '"></span>';

    // These comments are still editable
    if ($variables['user']->uid && comment_num_replies($variables['comment']->cid) == 0) {
      $variables['links'] .= '<span class="authcache-comment-edit" data-comment-uid="' . $variables['comment']->uid . '" data-comment-id="' . $variables['comment']->cid . '"></span>';
    }
  }
}