Alternative page for unpublished content

Events happening in the community are now at Drupal community events on www.drupal.org.
alexkb's picture

I'm wondering if anyone's aware of a module that lets you set up, much like how the alternative 404 & 403 feature works in core (set in Site configuration), the display of an alternative page if a page is accessed which may exist, but which might not be published.

This would of course only apply to those users that didn't have the "view unpublished content" permission set.

I'm guessing the actual functionality could be achieved with hook_node_access(), which could check the current node's published status and the users permission and then node_load the customised page node. Maybe.. just an idea..

I've googled around and found view_unpublished and override_node_options, but these fulfil a different requirement.

If this hasn't been done before, I'd be happy to try write something up and share, but don't want to be reinventing the wheel of course.

Comments

I'm not aware of any module

Garrett Albright's picture

I'm not aware of any module like that; sounds like an interesting idea. But one thing I'd note is that if you decide to make it yourself, be sure to ensure that the code still sends a 404, 403, or some more appropriate status code to the browser along with its human-readable body. That way, search engines and other non-humans will still be able to notice the page they're trying to access is not accessible for a particular reason.

Are you thinking along the

arpieb's picture

Are you thinking along the lines of having this be configurable on a per-content-type basis with a global default, or just a single-page solution?

It might be nice to be able to specify it on a type level as some sites might have a subscription service that could pop up different marketing prompts if access was denied for their role for a certain content type, or a custom link into alternate content or landing pages for the type (e.g. blog, forum, book, etc) if a specific node is unpublished even if the user has view permissions for the type.

Contributed Module Ideas

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: