function webform_protected_downloads_node_insert in Webform Protected Downloads 7
Implementation of hook_insert().
File
- ./
webform_protected_downloads.module, line 373 - This file contains hook declarations and functions for the Webform Protected Downloads module.
Code
function webform_protected_downloads_node_insert($node) {
// check for webform enabled node types and programatically created nodes
// with a wpd configuration
if (webform_protected_downloads_node_is_webform($node) && isset($node->wpd) && $node->nid != $node->wpd['nid']) {
// a new node has probably been created programatically or by a helper
// module like node_clone, here we must therefore save all the necessary
// data
webform_protected_downloads_set_configuration($node->nid, (array) $node->wpd['config']);
foreach ($node->wpd['protected_files'] as $file) {
webform_protected_downloads_file_set_protected($node->nid, $file->fid, TRUE);
}
}
}