function node_authlink_node_presave in Node authorize link 7
Implements hook_node_presave().
Pre-generate auth key for the new node (e.g. for use in Rules).
File
- ./node_authlink.module, line 240 
- Provides functionality for the node_authlink module.
Code
function node_authlink_node_presave($node) {
  // Ignore if node type is disabled.
  if (!variable_get('node_authlink_enable_' . $node->type, FALSE)) {
    return;
  }
  // Generate key.
  if (!isset($node->authkey)) {
    $node->authkey = hash('sha256', drupal_random_bytes(64));
  }
}