function comment_file_download_access

comment_file_download_access($field, $entity_type, $entity)

Implements hook_file_download_access().

File

modules/comment/comment.module, line 2738
Enables users to comment on published content.

Code

function comment_file_download_access($field, $entity_type, $entity) {
  if ($entity_type == 'comment') {
    if (user_access('access comments') && $entity->status == COMMENT_PUBLISHED || user_access('administer comments')) {
      $node = node_load($entity->nid);
      return node_access('view', $node);
    }
    return FALSE;
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!comment!comment.module/function/comment_file_download_access/7.x