You are here

function download_count_nodeapi in Download Count 6

Same name and namespace in other branches
  1. 5 download_count.module \download_count_nodeapi()
  2. 6.2 download_count.module \download_count_nodeapi()

Implementation of hook_nodeapi()

File

./download_count.module, line 189
Download counter

Code

function download_count_nodeapi(&$node, $op) {
  if ($op == 'alter') {
    global $user;
    if ($user->uid == 1 && variable_get('do_not_show_download_count_in_node_for_admin', FALSE)) {
      return;
    }
    if (!$node->teaser && count($node->files)) {
      if (user_access('view all downloads count in nodes') || user_access('view own nodes downloads count in nodes') && $node->uid == $user->uid) {
        $node->body = theme('download_count_body', $node);
      }
    }
  }
}