You are here

function vud_comment_preprocess_comment in Vote Up/Down 7

Same name and namespace in other branches
  1. 6.3 vud_comment/vud_comment.module \vud_comment_preprocess_comment()
  2. 6.2 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 148
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.
  $entity_id = $variables['comment']->cid;
  $tag = variable_get('vud_tag', 'vote');
  $criteria = array(
    'entity_type' => 'comment',
    'entity_id' => $entity_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';
  }
}