You are here

function vud_comment_comment in Vote Up/Down 6.2

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

Implementation of hook_comment().

File

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

Code

function vud_comment_comment(&$comment, $op) {
  switch ($op) {
    case 'view':
      if (!isset($comment->cid)) {
        return;
      }
      $type = _vud_comment_get_node_type($comment->nid);
      $comment_allow = in_array($type, variable_get('vud_comment_node_types', array()), TRUE);
      if ($comment_allow && user_access('use vote up/down on comments')) {
        $tag = variable_get('vud_tag', 'vote');
        $widget = variable_get('vud_comment_widget', 'plain');
        $comment->vud_comment_widget = theme('vud_widget', $comment->cid, 'comment', $tag, $widget);
        if (variable_get('vud_comment_widget_display', VUD_COMMENT_DISPLAY_NORMAL) == VUD_COMMENT_DISPLAY_NORMAL) {
          $comment->comment = $comment->vud_comment_widget . $comment->comment;
        }
      }
      break;
  }
}