Public Post Preview - Version 2.1.1

Version Description

(20012-09-19): = * Sorry for the new update. Through a change in 2.1 a filter was applied to each query. The misplaced "The link has been expired!" message is now gone. Props Aki Bjrklund and Jonathan Channon.

Download this release

Release Info

Developer ocean90
Plugin Icon 128x128 Public Post Preview
Version 2.1.1
Comparing to
See all releases

Code changes from version 2.1 to 2.1.1

Files changed (2) hide show
  1. public-post-preview.php +6 -4
  2. readme.txt +5 -2
public-post-preview.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: Public Post Preview
4
- * Version: 2.1
5
  * Description: Enables you to give a link to anonymous users for public preview of any post type before it is published.
6
  * Author: Dominik Schilling
7
  * Author URI: http://wphelper.de/
@@ -65,14 +65,13 @@ class DS_Public_Post_Preview {
65
  * @since 1.0.0
66
  */
67
  public static function init() {
 
 
68
  if ( ! is_admin() ) {
69
  add_filter( 'pre_get_posts', array( __CLASS__, 'show_public_preview' ) );
70
 
71
  add_filter( 'query_vars', array( __CLASS__, 'add_query_var' ) );
72
  } else {
73
-
74
- add_action( 'init', array( __CLASS__, 'load_textdomain' ) );
75
-
76
  add_action( 'add_meta_boxes', array( __CLASS__, 'register_meta_boxes' ) );
77
 
78
  add_action( 'save_post', array( __CLASS__, 'register_public_preview' ), 20, 2 );
@@ -355,6 +354,9 @@ class DS_Public_Post_Preview {
355
  * @param array $posts The post to preview.
356
  */
357
  public static function set_post_to_publish( $posts ) {
 
 
 
358
  if ( empty( $posts ) )
359
  return;
360
 
1
  <?php
2
  /**
3
  * Plugin Name: Public Post Preview
4
+ * Version: 2.1.1
5
  * Description: Enables you to give a link to anonymous users for public preview of any post type before it is published.
6
  * Author: Dominik Schilling
7
  * Author URI: http://wphelper.de/
65
  * @since 1.0.0
66
  */
67
  public static function init() {
68
+ add_action( 'init', array( __CLASS__, 'load_textdomain' ) );
69
+
70
  if ( ! is_admin() ) {
71
  add_filter( 'pre_get_posts', array( __CLASS__, 'show_public_preview' ) );
72
 
73
  add_filter( 'query_vars', array( __CLASS__, 'add_query_var' ) );
74
  } else {
 
 
 
75
  add_action( 'add_meta_boxes', array( __CLASS__, 'register_meta_boxes' ) );
76
 
77
  add_action( 'save_post', array( __CLASS__, 'register_public_preview' ), 20, 2 );
354
  * @param array $posts The post to preview.
355
  */
356
  public static function set_post_to_publish( $posts ) {
357
+ // Remove the filter again, otherwise it will be applied to other queries too.
358
+ remove_filter( 'posts_results', array( __CLASS__, 'set_post_to_publish' ), 10, 2 );
359
+
360
  if ( empty( $posts ) )
361
  return;
362
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: public, post, preview, posts, custom post types
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VR8YU922B7K46
5
  Requires at least: 3.3
6
  Tested up to: 3.5
7
- Stable tag: 2.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -66,7 +66,7 @@ New plugin maintainer, supports now all public post types, saves preview status
66
  * The link will be displayed if the checkbox is checked, just copy and share the link with your frieds.
67
  * To disable a preview just uncheck the box.
68
 
69
- == FAQ ==
70
 
71
  **I have activated the "WordPress SEO by Yoast" plugin and enabled the option "Redirect ugly URL's to clean permalinks.". The public preview doesn't work. What can I do?**
72
 
@@ -88,6 +88,9 @@ function my_nonce_life() {
88
  }`
89
 
90
  == Change Log ==
 
 
 
91
  = 2.1 (20012-09-16): =
92
  * Introduces a filter `ppp_nonce_life`. With the filter you can adjust the expiration of a link. By default a link has a lifetime of 48 hours.
93
  * In some situations (still not sure when) the preview link is rewritten as a permalink which results in an error. The plugin now works in this situations too.
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VR8YU922B7K46
5
  Requires at least: 3.3
6
  Tested up to: 3.5
7
+ Stable tag: 2.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
66
  * The link will be displayed if the checkbox is checked, just copy and share the link with your frieds.
67
  * To disable a preview just uncheck the box.
68
 
69
+ == Frequently Asked Questions ==
70
 
71
  **I have activated the "WordPress SEO by Yoast" plugin and enabled the option "Redirect ugly URL's to clean permalinks.". The public preview doesn't work. What can I do?**
72
 
88
  }`
89
 
90
  == Change Log ==
91
+ = 2.1.1 (20012-09-19): =
92
+ * Sorry for the new update. Through a change in 2.1 a filter was applied to each query. The misplaced "The link has been expired!" message is now gone. Props Aki Björklund and Jonathan Channon.
93
+
94
  = 2.1 (20012-09-16): =
95
  * Introduces a filter `ppp_nonce_life`. With the filter you can adjust the expiration of a link. By default a link has a lifetime of 48 hours.
96
  * In some situations (still not sure when) the preview link is rewritten as a permalink which results in an error. The plugin now works in this situations too.