By james, 6 December, 2022
Advent Calendar door 6 containing the Access Unpublished module

Welcome to day 6 of the Drupal Advent Calendar, and today’s door is another simple yet helpful module.

Have you ever had a piece of content that you needed to have someone review before going live?

Of course you could copy and paste it into an email, but that can be error prone, and may not appear exactly as it will be on the site, so errors with formatting can be missed.

Out of the box, Drupal as a “view unpublished content” permission that can be granted to a user. However, that will give access to all unpublished content, which you may not want to do if you are running a busy site. This approach also requires a user account, which can be extra hassle and is an extra hoop for the person checking the content to jump through.

This is where the Access Unpublished module comes in handy.

To set it up, simply install the module and grant the Access unpublished for your content type permission to anonymous users. Then, while editing the unpublished content item, expand the “Temporary unpublished access”, and click “Generate Token”.

Preview of the Temporary unpublished access panel of a content item

This will generate a URL that you can share with users that allows the unpublished item to be previewed. It allows you to specify an expiry date, so the link will only work for a limited time, and if a link escapes into the wild, the token can be deleted so the link will no longer work. It’s also possible to renew an expired token if required. Multiple tokens can be generated so each content checker can be given a unique URL.

This is a simple module, but a very valuable one if you want to have reviewers check content before publication.

And that wraps up day 6. Join me tomorrow for the next door of our calendar.

Drupal Advent Calendar with door 6 open, revealing the Access Unpublished module



Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.