You are here

function comment_upload_comment_view in Comment Upload 6

Add attachments to the comment on view or preview.

Parameters

object $comment:

1 call to comment_upload_comment_view()
comment_upload_comment in ./comment_upload.module
Implementation of hook_comment().

File

./comment_upload.module, line 375
Provides file attachment functionality for comments.

Code

function comment_upload_comment_view(&$comment) {
  $display_images = FALSE;
  $preset_name = '';
  if (isset($comment->files)) {
    $files = $comment->files;
  }
  else {
    $files = comment_upload_load_files($comment->cid);
  }
  if (isset($files) && count($files)) {
    if (user_access('view files uploaded to comments')) {
      $node = node_load($comment->nid);
      $display_setting = variable_get('comment_upload_images_' . $node->type, 'none');
      if ($display_setting != 'none') {
        $display_images = TRUE;
        if (is_numeric($display_setting)) {
          $imagecache_preset = imagecache_preset($display_setting);
          $preset_name = $imagecache_preset['presetname'];
        }
      }
      $comment->files = $files;
      $comment->comment .= theme('comment_upload_attachments', $files, $display_images, $preset_name);
    }
  }
}