How can we view the latest unpublished version of a node even if a previous revision was published?

The scenario: All staff have "View any unpublished". They edit a node a few times, publish it, then un-publish it (because they decide it’s not ready). Then they edit a few more revisions. Now they want to send it to someone who only has view permission for review before making it public again.

This is the problem: When they go to view the node they see the version that was at one time published. Therefore in view mode some of the recent changes are not visible. Viewing the latest revision in the revision tab doesn’t see to be a workaround, if the latest revision is selected we still see the latest published version – and the route is exactly the same as the "view" route.

I think there may be a core bug for this already but I can’t locate it.

I have run this through the debugger and I can see the revision id’s being swapped out. I didn’t get time to figure out the logic completely.

I started to think it might be related to Update access is broken on sites using node access records and node grants from Workbench Moderation, which was the original source of the View all unpublished permission. I tried making a view of all revisions to see if I could find a problematic revision id with no success. On some nodes all revisions are unpublished but we do not see the latest one on the "View" route. I also tried the workspaces module since that would be very close to what we need here but that seemed to cause other issues of a similar nature. I had one node that wouldn’t save at all with workspaces enabled due to some validation around publication status.

How can I make this scenario work for the editors with the View all unpublished permission?

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

How can we view the latest unpublished version of a node even if a previous revision was published?

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.