You are here

function webform_protected_downloads_node_has_protected_files in Webform Protected Downloads 7

Same name and namespace in other branches
  1. 6 webform_protected_downloads.module \webform_protected_downloads_node_has_protected_files()

Checks if the given node has protected files

Parameters

int $nid:

Return value

void

5 calls to webform_protected_downloads_node_has_protected_files()
webform_protected_downloads_component_delete_access in ./webform_protected_downloads.module
Custom access callback that checks wheather a webform component can be deleted
webform_protected_downloads_form_alter in ./webform_protected_downloads.module
Implementation of hook_form_alter().
webform_protected_downloads_node_load in ./webform_protected_downloads.module
Implementation of hook_node_load().
webform_protected_downloads_node_view in ./webform_protected_downloads.module
Implementation of hook_node_view().
webform_protected_downloads_process_submissions in ./webform_protected_downloads.module
Process unprocessed webform submissions

File

./webform_protected_downloads.module, line 711
This file contains hook declarations and functions for the Webform Protected Downloads module.

Code

function webform_protected_downloads_node_has_protected_files($nid) {
  $wpd_nodes =& drupal_static(__FUNCTION__);
  if (!isset($wpd_nodes[$nid])) {
    $count = db_query("SELECT COUNT(*) FROM {wpd_protected_files} WHERE nid = :nid", array(
      ':nid' => $nid,
    ))
      ->fetchColumn();
    $wpd_nodes[$nid] = $count > 0;
  }
  return $wpd_nodes[$nid];
}