My team had trouble getting a View with the "Published or admin" filter to show unpublished content, with the View Unpublished module enabled, logged in as a user who just had the "view any unpublished content" permission (but not the node-type-specific permissions). We found that there was no explicit check for the "any" permission in the Views handler that comes with this module. So this patch:

  • Adds a token for the "view any unpublished content" permission, using hook_views_query_subsititutions().
  • Changes the query in the handler to check for the tokenized permission.
  • As a bonus, changes the check for ***ADMINISTER_NODES*** to ***BYPASS_ACCESS_CONTROLS***, as that update has been applied to the latest version of the core Views handler.

Wanted to share this approach, which solved the issue for us, in the event it's helpful to the module's users or maintainers. Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rohnjeynolds created an issue. See original summary.

rohnjeynolds’s picture

FileSize
1.74 KB
ciss’s picture

Status: Active » Needs review