You are here

function subscriptions_content_workbench_moderation_check_is_unpublished in Subscriptions 7

Same name and namespace in other branches
  1. 2.0.x subscriptions_content/subscriptions_content.module \subscriptions_content_workbench_moderation_check_is_unpublished()

Check if a node that is moderated by workbench is actually published.

Parameters

object $node: The node object of a workbench_moderation moderated node.

Return value

bool Returns TRUE if the node is unpublished by workbench_moderation standards.

1 call to subscriptions_content_workbench_moderation_check_is_unpublished()
subscriptions_content_node_load in ./subscriptions_content.module
Implements hook_node_load().

File

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

Code

function subscriptions_content_workbench_moderation_check_is_unpublished($node) {
  $states = db_select('workbench_moderation_node_history', 'wbmnh')
    ->condition('nid', $node->nid)
    ->fields('wbmnh', array(
    'state',
  ))
    ->execute()
    ->fetchCol();
  $states = array_count_values($states);

  // Is there any published states in the history? If so it has been published
  // before.
  if (empty($states[workbench_moderation_state_published()])) {
    return TRUE;
  }
  return FALSE;
}