Public Post Preview - Version 1.3

Version Description

(2009-06-30): = * Hook in earlier in the post selection process to fix PHP notices * Add uninstall functionality to remove options from the options table

Download this release

Release Info

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

Code changes from version 1.2 to 1.3

Files changed (3) hide show
  1. public-post-preview.php +12 -6
  2. readme.txt +8 -4
  3. uninstall.php +8 -0
public-post-preview.php CHANGED
@@ -1,11 +1,15 @@
1
  <?php
2
  /*
3
  Plugin Name: Public Post Preview
4
- Plugin URI: http://sivel.net/wordpress/public-post-preview/
5
  Description: Enables you to give a link to anonymous users for public preview of a post before it is published.
6
  Author: Matt Martz</a> and <a href='http://www.ginside.com/'>Jonathan Dingman</a>
7
- Version: 1.2
8
  Author URI: http://sivel.net/
 
 
 
 
9
  */
10
 
11
  class Public_Post_Preview {
@@ -99,15 +103,17 @@ class Public_Post_Preview {
99
  if ( false == $this->verify_nonce($_GET['nonce'], 'public_post_preview_' . $this->id) || isset($preview_posts[$this->id]) )
100
  wp_die('You do not have permission to publicly preview this post.');
101
 
102
- add_filter('the_posts', array(&$this, 'insert_preview'));
103
  }
104
  }
105
 
106
- // Insert the requested preview post into posts array
107
- function insert_preview($posts) {
108
- $posts[] = get_post($this->id);
109
  return $posts;
110
  }
111
  }
 
112
  $Public_Post_Preview = new Public_Post_Preview();
 
113
  ?>
1
  <?php
2
  /*
3
  Plugin Name: Public Post Preview
4
+ Plugin URI: http://sivel.net/wordpress/
5
  Description: Enables you to give a link to anonymous users for public preview of a post before it is published.
6
  Author: Matt Martz</a> and <a href='http://www.ginside.com/'>Jonathan Dingman</a>
7
+ Version: 1.3
8
  Author URI: http://sivel.net/
9
+
10
+ Copyright (c) 2009-2010 Matt Martz (http://sivel.net)
11
+ Public Post Preview is released under the GNU General Public License (GPL)
12
+ http://www.gnu.org/licenses/gpl-2.0.txt
13
  */
14
 
15
  class Public_Post_Preview {
103
  if ( false == $this->verify_nonce($_GET['nonce'], 'public_post_preview_' . $this->id) || isset($preview_posts[$this->id]) )
104
  wp_die('You do not have permission to publicly preview this post.');
105
 
106
+ add_filter('posts_results', array(&$this, 'fake_publish'));
107
  }
108
  }
109
 
110
+ // Fake the post being published so we don't have to do anything *too* hacky to get it to load the preview
111
+ function fake_publish($posts) {
112
+ $posts[0]->post_status = 'publish';
113
  return $posts;
114
  }
115
  }
116
+
117
  $Public_Post_Preview = new Public_Post_Preview();
118
+
119
  ?>
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Public Post Preview ===
2
- Contributors: sivel, jdingman
3
- Donate Link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=C3UA7TDWM4NLQ&lc=US&item_name=Donations%20for%20Sivel%2enet%20WordPress%20Plugins&cn=Add%20special%20instructions%20to%20the%20seller&no_shipping=1&rm=1&return=http%3a%2f%2fsivel%2enet%2fthanks&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
  Tags: public-post-preview, public, post, preview, posts
5
  Requires at least: 2.7
6
  Tested up to: 2.9
7
- Stable tag: 1.2
8
 
9
  Enables you to give a link to anonymous users for public preview of a post before it is published.
10
 
@@ -38,7 +38,11 @@ NOTE: See "Other Notes" for Upgrade and Usage Instructions as well as other pert
38
  1. By default all posts in draft or pending review status will have public preview links that can be found diretly below the edit post box.
39
  1. To disable public post preview for a specific post uncheck the public preview post box and save the post.
40
 
41
- == Changelog ==
 
 
 
 
42
 
43
  = 1.2 (2009-03-30): =
44
  * Fix preview URL for scheduled posts on sites with a permalink other than default activated.
1
  === Public Post Preview ===
2
+ Contributors: ocean90, sivel, jdingman
3
+ Donate Link: http://sivel.net/donate
4
  Tags: public-post-preview, public, post, preview, posts
5
  Requires at least: 2.7
6
  Tested up to: 2.9
7
+ Stable tag: 1.3
8
 
9
  Enables you to give a link to anonymous users for public preview of a post before it is published.
10
 
38
  1. By default all posts in draft or pending review status will have public preview links that can be found diretly below the edit post box.
39
  1. To disable public post preview for a specific post uncheck the public preview post box and save the post.
40
 
41
+ == Change Log ==
42
+
43
+ = 1.3 (2009-06-30): =
44
+ * Hook in earlier in the post selection process to fix PHP notices
45
+ * Add uninstall functionality to remove options from the options table
46
 
47
  = 1.2 (2009-03-30): =
48
  * Fix preview URL for scheduled posts on sites with a permalink other than default activated.
uninstall.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // If uninstall/delete not called from WordPress then exit
3
+ if ( ! defined('ABSPATH') && ! defined('WP_UNINSTALL_PLUGIN') )
4
+ exit();
5
+
6
+ // Delete option from options table
7
+ delete_option('public_post_preview');
8
+ ?>