You are here

function view_unpublished_views_query_substitutions in view_unpublished 6

Same name and namespace in other branches
  1. 8 view_unpublished.views_execution.inc \view_unpublished_views_query_substitutions()
  2. 7 view_unpublished.module \view_unpublished_views_query_substitutions()

Implementation of hook_views_query_substitutions().

File

./view_unpublished.module, line 90
Allow users to view all unpublished nodes, or unpublished nodes of a specific type.

Code

function view_unpublished_views_query_substitutions() {
  $substitutions = array(
    '***VIEWALLUNPUBLISHED_NODES***' => intval(user_access('view all unpublished content')),
  );
  foreach (node_get_types() as $type => $name) {
    $substitutions["***VIEWUNPUBLISHED_{$type}***"] = intval(user_access('view unpublished ' . $type . ' content'));
  }
  return $substitutions;
}