Post Expirator - Version 1.3.1

Version Description

Download this release

Release Info

Developer axelseaa
Plugin Icon 128x128 Post Expirator
Version 1.3.1
Comparing to
See all releases

Code changes from version 1.3 to 1.3.1

Files changed (2) hide show
  1. post-expirator.php +14 -3
  2. readme.txt +4 -0
post-expirator.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Post Expirator
4
  Plugin URI: http://wordpress.org/extend/plugins/post-expirator/
5
  Description: Allows you to add an expiration date (hourly) to posts which you can configure to either delete the post or change it to a draft.
6
  Author: Aaron Axelsen
7
- Version: 1.3
8
  Author URI: http://www.frozenpc.net
9
  */
10
 
@@ -14,13 +14,24 @@ $expirationdateDefaultTimeFormat = 'g:ia';
14
  $expirationdateDefaultFooterContents = 'Post expires at EXPIRATIONTIME on EXPIRATIONDATE';
15
  $expirationdateDefaultFooterStyle = 'font-style: italic;';
16
 
 
 
 
 
 
 
 
 
 
 
 
17
  /**
18
  * Function that does the actualy deleting - called by wp_cron
19
  */
20
  function expirationdate_delete_expired_posts() {
21
  global $wpdb;
22
- $result = $wpdb->get_results('select post_id, meta_value from ' . $wpdb->postmeta . ' where meta_key = "expiration-date" AND meta_value <= "' . mktime() . '"');
23
- foreach ($result as $a) {
24
  $post_result = $wpdb->get_var('select post_type from ' . $wpdb->posts .' where ID = '. $a->post_id);
25
  if ($post_result == 'post') {
26
  $expiredStatus = strtolower(get_option('expirationdateExpiredPostStatus'));
4
  Plugin URI: http://wordpress.org/extend/plugins/post-expirator/
5
  Description: Allows you to add an expiration date (hourly) to posts which you can configure to either delete the post or change it to a draft.
6
  Author: Aaron Axelsen
7
+ Version: 1.3.1
8
  Author URI: http://www.frozenpc.net
9
  */
10
 
14
  $expirationdateDefaultFooterContents = 'Post expires at EXPIRATIONTIME on EXPIRATIONDATE';
15
  $expirationdateDefaultFooterStyle = 'font-style: italic;';
16
 
17
+ # Save for future use
18
+ #function blah_blah_blah($array) {
19
+ # $array['minute'] = array(
20
+ # 'interval' => 60,
21
+ # 'display' => __('Once a Minute')
22
+ # );
23
+ # return $array;
24
+ #}
25
+ #add_filter('cron_schedules','blah_blah_blah');
26
+ #print_r(wp_get_schedules());
27
+
28
  /**
29
  * Function that does the actualy deleting - called by wp_cron
30
  */
31
  function expirationdate_delete_expired_posts() {
32
  global $wpdb;
33
+ $result = $wpdb->get_results('select post_id, meta_value from ' . $wpdb->postmeta . ' as postmeta, '.$wpdb->posts.' as posts where postmeta.post_id = posts.ID AND posts.post_status = "publish" AND postmeta.meta_key = "expiration-date" AND postmeta.meta_value <= "' . mktime() . '"');
34
+ if (!empty($result)) foreach ($result as $a) {
35
  $post_result = $wpdb->get_var('select post_type from ' . $wpdb->posts .' where ID = '. $a->post_id);
36
  if ($post_result == 'post') {
37
  $expiredStatus = strtolower(get_option('expirationdateExpiredPostStatus'));
readme.txt CHANGED
@@ -41,6 +41,10 @@ This section describes how to install the plugin and get it working.
41
 
42
  == Changelog ==
43
 
 
 
 
 
44
  **Version 1.3**
45
 
46
  * Expiration date is now retained across all post status changes
41
 
42
  == Changelog ==
43
 
44
+ **Version 1.3.1**
45
+
46
+ * Fixed sporadic issue of expired posts not being removed
47
+
48
  **Version 1.3**
49
 
50
  * Expiration date is now retained across all post status changes