You are here

function subscriptions_content_node_load in Subscriptions 7

Same name and namespace in other branches
  1. 5.2 subscriptions_content.module \subscriptions_content_node_load()
  2. 6 subscriptions_content.module \subscriptions_content_node_load()
  3. 2.0.x subscriptions_content/subscriptions_content.module \subscriptions_content_node_load()

Implements hook_node_load().

Keeps track of the unpublished nodes and determines whether notifications should be sent for each node.

Parameters

array $nodes:

array $types:

File

./subscriptions_content.module, line 247
Subscriptions to content events

Code

function subscriptions_content_node_load(array $nodes, array $types) {
  $unpublished_nids =& drupal_static('subscriptions_content_unpublished_nids', array());
  foreach ($nodes as $node) {
    if (!$node->status) {

      // Since workbench_moderate does some unconventional things to the node
      // statuses we need to make a special case to check if a node that is
      // moderated by workbench_moderation is actually unpublished.
      if (module_exists('workbench_moderation') && workbench_moderation_node_type_moderated($node->type)) {
        if (subscriptions_content_workbench_moderation_check_is_unpublished($node)) {
          $unpublished_nids[] = $node->nid;
        }
      }
      else {
        $unpublished_nids[] = $node->nid;
      }
    }
    subscriptions_content_node_prepare($node);
  }
}