WordPress.org

Ready to get started?Download WordPress

Forums

Public Post Preview
[resolved] Stopped Working (25 posts)

  1. airlinereporter
    Member
    Posted 1 year ago #

    Hey Dominik,

    Great plug-in that I use all the time. I just recently upgraded to the new version: 2.0.1 and now it won't work. It shows up just fine and let's me copy the link, but when someone tries to view it, I get: "Not Found: Sorry, but you are looking for something that isn't here."

    Also, my google ad, which is normally on the right bar, now shows up on my header. Any ideas?

    Thanks,
    David
    Airlinereporter.com

    http://wordpress.org/extend/plugins/public-post-preview/

  2. Dominik Schilling (ocean90)
    WordPress Dev
    Plugin Author

    Posted 1 year ago #

    Which was your previous version?

  3. mike
    Member
    Posted 1 year ago #

    Similar problem: preview links now only work for logged in users and result in 404 otherwise. The url seems to have changed:

    Old (v2.0.1) of the plugin):
    http://example.com/?p=2012041336&preview=true&preview_id=2012041336&public=1&nonce=1ae17b81c2

    New (v2.0)
    http://example.com/2012/09/02/post-title-string/?preview=1&_ppp=e42872b7c6

    I reverted to 2.0 and the same behavior exists. Thanks!

  4. mike
    Member
    Posted 1 year ago #

    I have found that if I replace the permalink structure with ?p=POSTIDHERE, the preview links work for non-logged in users. So I wondered if it had something to do with the htaccess/permalink rules. I disabled my caching plugin that modifies that file, but I couldn't remove the issue. I have started to deactivate other plugins, but to no avail. It seems intimately tied to permalinks and user login hooks, so perhaps my custom theme + new plugin update is the culprit?

  5. Dominik Schilling (ocean90)
    WordPress Dev
    Plugin Author

    Posted 1 year ago #

    Thanks for your comment mike.
    I will try to figure out what's going on there.

    Could you please post your permalinks setting and which cache plugin are you using?

  6. slips111
    Member
    Posted 1 year ago #

    Me too. Fully updated. Link gives a 404 error.

  7. AEG-wiz
    Member
    Posted 1 year ago #

    Hi Dominik.

    I'm noticing the same thing. Since you haven't yet received a response from mike, I can at least provide you with my settings:

    using W3 Total Cache and just the 'post name' permalink setting (/%postname%/)

    I haven't messed around yet with disabling things to test it out. But I can confirm that a preview link that isn't using mod_rewrite (i.e., manually changing the provided preview URL to the querystring vars instead) works fine, while the permalink structure does not.

    This of course refers only to users who are not logged in, since all logged in users on my site have permissions to view previews for the post_types in question (this is a custom post_type I'm working with so far, by the way -- though I assume it would be no different for 'post'). Also potentially pertinent: the post_type uses a rewrite value too, though it is not visible in the post or preview permalinks, it is provided in the 'register_post_type' call.

    I'll be looking into a hook to rewrite the permalinks without the mod_rewrites if you aren't able to find a fix. Perhaps 'preview_post_link' depending on what your code does.

    Thank you!

  8. mike
    Member
    Posted 1 year ago #

    Thanks for the reply:

    /%author%/%year%/%monthnum%/%day%/%postname%/

    (this is a bit quirky)

    and using W3 Total Cache, however, disabling it doesn't fix things. My users now solve this problem by replacing the permalink in the preview url and finding the postID to revert to the old format. Works that way, but a bit clunky!

  9. AEG-wiz
    Member
    Posted 1 year ago #

    For anyone looking into the same problem, I've just discovered that I don't have to remove the permalink structure, I can just append the &p=[post_id] directly to the preview link provided for success. Works for my permalink structure anyhow which is fairly simple /%postname%/.

    Dominik: one way that you may be able to help fix this in future releases is by adding the preview_post_link and/or preview_page_link filters to your get_preview_link method.

    An example from /wp-includes/meta-boxes.php : post_submit_meta_box() is as follows...

    $preview_link = get_permalink( $post->ID );
    	if ( is_ssl() )
    		$preview_link = str_replace( 'http://', 'https://', $preview_link );
    	$preview_link = esc_url( apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ) ) );

    That is the code used for the preview button in the submit/publish metabox on the edit post page. With that filter in place in your plugin, those of us affected could hook into it and add the required p var.

    Hope that's a helpful start.

  10. mike
    Member
    Posted 1 year ago #

    AEG-wiz: That hack to append the &p=XXXX works for my quirky permalinks. It is a much easier hack than earlier.

  11. Dominik Schilling (ocean90)
    WordPress Dev
    Plugin Author

    Posted 1 year ago #

    I still can't reproduce your problems. Tested with your permalink settings and default settings from W3 Total Cache,

    With version 2.0 the preview link was reduced to just the needed args, which are p and _ppp. p contains the post id and _ppp the nonce.

    Example: http://wp34.dev/?p=16&preview=1&_ppp=ef22678f2c

    So if you already shared your links with version < 2.0 with a longer nonce time, yes, these links won't work any longer. That's intentionally.

    Taking a look at mike's post again, I'm not sure if you mixed the versions. The change between 2.0.1 and 2.0 just was this line.

    So if somebody has some more details on how I can reproduce the issue please write me a line, either here or to dominik DOT schilling AT gmail DOT com.

  12. Dominik Schilling (ocean90)
    WordPress Dev
    Plugin Author

    Posted 1 year ago #

    Are you all using the "WordPress SEO by Yoast"? Do you have activated the option "Redirect ugly URL's to clean permalinks. (Not recommended in many cases!)" under SEO-Permalinks?

    If so, please add _ppp to the input field under "Other variables not to clean:" and check if it helps.

  13. mike
    Member
    Posted 1 year ago #

    I don't have that plugin. Here is my list

    Akismet
    Better Blogroll
    FD Feedburner
    Get Author Profile
    Hide or Show Comments
    Image Caption
    IntenseDebate
    Jetpack
    Latest Posts by Author
    Scheduled M.I.A.s
    Simply Exclude
    Sucuri Security
    Text Control
    Vaultpress
    W3 Cache
    Wickett Twitter Widget
    WP Print
    WP Touch

    Phew, that's a lot!

  14. Dominik Schilling (ocean90)
    WordPress Dev
    Plugin Author

    Posted 1 year ago #

    I did a small restructuring of the plugin.
    (http://plugins.trac.wordpress.org/changeset/599022/public-post-preview)

    Could you please test the dev version and check if the problem still exists?

    http://downloads.wordpress.org/plugin/public-post-preview.zip

  15. AEG-wiz
    Member
    Posted 1 year ago #

    Hi Dominik.

    I was a bit confused by your earlier post made 2 days ago, but if I am reading it correctly you are saying that the preview links are not expected to be rewritten as permalinks, based on your code logic. I downloaded the zip you provided above, and tested the links again.

    I am seeing the following behavior: My preview links get rewritten with the permalink structure with preview=1&_ppp={nonce} appended. If I add the p={post_id} parameter back onto the URL it works fine for public preview (NB: adding the p parameter to the permalink structure and submitting it to the browser then redirects the URL back to it's non-mod_rewrite state). But as provided, the preview link does not work.

    This is some improvement over testing problems I encountered yesterday, but so far it appears that the 'p' parameter is always converted into the permalink structure instead.

    Also, I am not using the plugin you mentioned above - nor anything similar. I did disable all plugins earlier in my testing without impact on Public Post Preview.

  16. AEG-wiz
    Member
    Posted 1 year ago #

    Here's an example of my permalink structure:

    Custom Post Type: portfolio (rewritten to 'directory')
    http://wp.mydomain.com/?p={post_id}&post_type=portfolio
    gets rewritten to:
    http://wp.mydomain.com/directory/{post_name}/

    Preview link provided by plugin:
    http://wp.mydomain.com/directory/{post_name}/?preview=1&_ppp={nonce} DOES NOT WORK FOR PUBLIC PREVIEW

    adding 'p' parameter back:
    http://wp.mydomain.com/directory/{post_name}/?preview=1&_ppp={nonce}&p={post_id}
    automatically redirects to:
    http://wp.mydomain.com/?p={post_id}&post_type=portfolio&preview=1&_ppp={nonce} THIS LINK DOES WORK FOR PUBLIC PREVIEW

  17. Dominik Schilling (ocean90)
    WordPress Dev
    Plugin Author

    Posted 1 year ago #

    @AEG-wiz

    I was a bit confused by your earlier post made 2 days ago, but if I am reading it correctly you are saying that the preview links are not expected to be rewritten as permalinks

    Right.

    Did you tested the dev version? Still a problem?

  18. AEG-wiz
    Member
    Posted 1 year ago #

    Did you tested the dev version? Still a problem?

    Yes, I did test it. What you see above are the results of that test. I still get rewritten links. Perhaps it is because of the custom post type. If all I have to do is add the p parameter back onto the link, then it isn't such a big deal. I was having issues with that approach yesterday, but that shortcut seems to be working again with the new code you provided.

  19. Dominik Schilling (ocean90)
    WordPress Dev
    Plugin Author

    Posted 1 year ago #

    I still get rewritten links.

    Take a look at the preview link button in the publish metabox on the edit screen, how does it look?

    The rewritten links are not an issue of the plugin since it uses the same method as WordPress does.

  20. AEG-wiz
    Member
    Posted 1 year ago #

    Take a look at the preview link button in the publish metabox on the edit screen, how does it look?

    Ah, now that brings the issue to something interesting I noticed yesterday while testing:
    Right-click 'open in new tab' on the preview button opens the permalink structure link (and also does not work - even for logged in users). While just normally clicking on the preview button, directs the preview to the non-permalink URL. If I rollover the button or inspect its properties, it is permalink. But apparently there is some sort of javascript attached that rewrites that on the click event.

  21. Dominik Schilling (ocean90)
    WordPress Dev
    Plugin Author

    Posted 1 year ago #

    Alright, that's the same behavior as I got from some users via e-mail.

    So, you have all plugins disabled and the issue still persists? The goal is to find out, which plugin/function malforms the preview link.

    Btw: http://wp.mydomain.com/directory/{post_name}/?preview=1&_ppp={nonce}&p={post_id} doesn't make any sense with the new version. That's really odd.

  22. mike
    Member
    Posted 1 year ago #

    Dominik:

    That dev version appears to have fixed it for me (I can copy the permalink preview url and it works for logged-out users). Thanks!

  23. Dominik Schilling (ocean90)
    WordPress Dev
    Plugin Author

    Posted 1 year ago #

    @Mike,

    that's nice to hear. I'm waiting for feedback from other users and then I will make an official update.

  24. TheHighPlainsDrifter
    Member
    Posted 1 year ago #

    i downloaded this plugin through my blog admin panel and it didn't work

    i just manually installed that dev version and its now working for me

    thanks

  25. Dominik Schilling (ocean90)
    WordPress Dev
    Plugin Author

    Posted 1 year ago #

    The update is live.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.