You are here

function vud_comment_preprocess_comment in Vote Up/Down 6.2

Same name and namespace in other branches
  1. 6.3 vud_comment/vud_comment.module \vud_comment_preprocess_comment()
  2. 7 vud_comment/vud_comment.module \vud_comment_preprocess_comment()

Override or insert variables into the comment templates.

Parameters

$variables: An array of variables to pass to the theme template.

File

vud_comment/vud_comment.module, line 132
Adds a voting widget to comments.

Code

function vud_comment_preprocess_comment(&$variables) {
  if (variable_get('vud_comment_dim_active', 0) != '1') {
    return;
  }

  // Get total votes for this comment.
  $content_id = $variables['comment']->cid;
  $tag = variable_get('vud_tag', 'vote');
  $criteria = array(
    'content_type' => 'comment',
    'content_id' => $content_id,
    'value_type' => 'points',
    'tag' => $tag,
    'function' => 'sum',
  );
  $vud_sum = (int) votingapi_select_single_result_value($criteria);
  $vud_dim_threshold = (int) variable_get('vud_comment_dim_threshold', 0);
  if ($vud_sum <= $vud_dim_threshold) {
    $variables['status'] .= ' vud-comment-dimmed';
  }
}