Jump to content

Show unpublished page to logged out users


Torsten Baldes
 Share

Recommended Posts

Is it somehow possible to show an unpublished page to users, which are not logged in?

My editors would love to have a way to preview a page (e.g. sending a secret/encrypted link) to their colleagues before it goes published. So they can view it without having an account or logging in.

I guess we would have to somehow hook in the viewable function (PagePermissions.module) to get this done. But i have no idea how to this.

Thanks!

Link to comment
Share on other sites

You can make the page Hidden and put it somewhere in your structure that can't be easily guessed. From the outside, a page has to be published to be seen.

post-756-0-00826300-1409212239_thumb.png

Then you can give out this URL to whomever needs to see it.

An Example:  www.yourwebsite.com/cteded23xt4/review/preview-page-for-review/

  • Like 1
Link to comment
Share on other sites

It sounds more that your process needs refining.

I copy my unpublished pages that need review to a temporary url (as listed) and give that URL to whomever needs it.  Once finished with that page, I simply trash it.  The original page then gets edited or published.  The original content never gets moved.  It's just an affordable process to allow a review by outside interests.  

I use a project management system (PW based system) for any internal or client review.

  • Like 2
Link to comment
Share on other sites

What you could do (without making a mess)

Make a hidden page in you site tree as suggested, but the difference: give it a logical name like 'preview'.

This 'preview' page should have it's own template, call it preview or something and enable url segments.

On pages that you want to be previewed ad a FieldtypeTextUnique field, call it 'preview_code' or whatever you like.

Now on the hidden preview page something like this:

<?php

if (count($input->urlSegments) !== 1) {
    throw new Wire404Exception();
}

// get your page to preview
$preview = $pages->get("preview_code=" . $input->urlSegment1);

if (!$preview->id) {
    throw new Wire404Exception();
} else {
    echo $preview->render();
}

ps, not tested

Now you're able to give someone an URL like:

www.domain.ext/preview/vxrj9w765omxhg87g975ghu/

  • Like 4
Link to comment
Share on other sites

Wow! PM on PW? That sounds really interesting. Could you tell a bit more about it? Maybe in another topic...

@Ivan Gretsky, I will.  It will probably be a few months before that happens.  I currently have a second generation prototype working with a few of my clients now.  PW is proving to be a great platform for doing that type of thing.

  • Like 5
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...