4 * Contains functions only needed when rendering comments.
8 * Override or insert variables into the comment templates.
11 * An array of variables to pass to the theme template.
13 * The name of the template being rendered ("comment" in this case.)
15 function _zen_preprocess_comment(&$vars, $hook) {
16 // Add an "unpublished" flag.
17 $vars['unpublished'] = ($vars['comment']->status
== COMMENT_NOT_PUBLISHED
);
19 // If comment subjects are disabled, don't display them.
20 if (variable_get('comment_subject_field_' .
$vars['node']->type
, 1) == 0) {
24 // Special classes for comments.
25 $classes = array('comment');
26 if ($vars['comment']->new
) {
27 $classes[] = 'comment-new';
29 $classes[] = $vars['status'];
30 $classes[] = $vars['zebra'];
31 if ($vars['id'] == 1) {
34 if ($vars['id'] == $vars['node']->comment_count
) {
37 if ($vars['comment']->uid
== 0) {
38 // Comment is by an anonymous user.
39 $classes[] = 'comment-by-anon';
42 if ($vars['comment']->uid
== $vars['node']->uid
) {
43 // Comment is by the node author.
44 $classes[] = 'comment-by-author';
46 if ($vars['comment']->uid
== $GLOBALS['user']->uid
) {
47 // Comment was posted by current user.
48 $classes[] = 'comment-mine';
51 $vars['classes'] = implode(' ', $classes);