Post Expirator - Version 2.7.6

Version Description

Download this release

Release Info

Developer andergmartins
Plugin Icon 128x128 Post Expirator
Version 2.7.6
Comparing to
See all releases

Code changes from version 2.7.5 to 2.7.6

post-expirator.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: http://wordpress.org/extend/plugins/post-expirator/
5
  * Description: Allows you to add an expiration date (minute) to posts which you can configure to either delete the post, change it to a draft, or update the post categories at expiration time.
6
  * Author: PublishPress
7
- * Version: 2.7.5
8
  * Author URI: http://publishpress.com
9
  * Text Domain: post-expirator
10
  * Domain Path: /languages
@@ -27,7 +27,7 @@ if (class_exists('PublishPressInstanceProtection\\Config')) {
27
 
28
  if (! defined('POSTEXPIRATOR_LOADED')) {
29
  // Default Values
30
- define('POSTEXPIRATOR_VERSION', '2.7.5');
31
  define('POSTEXPIRATOR_DATEFORMAT', __('l F jS, Y', 'post-expirator'));
32
  define('POSTEXPIRATOR_TIMEFORMAT', __('g:ia', 'post-expirator'));
33
  define('POSTEXPIRATOR_FOOTERCONTENTS', __('Post expires at EXPIRATIONTIME on EXPIRATIONDATE', 'post-expirator'));
@@ -801,7 +801,9 @@ if (! defined('POSTEXPIRATOR_LOADED')) {
801
 
802
  $id = (int)$id;
803
 
804
- $debug->save(array('message' => 'Called postexpirator_expire_post with id=' . $id));
 
 
805
 
806
  if (empty($id)) {
807
  if (POSTEXPIRATOR_DEBUG) {
@@ -811,7 +813,9 @@ if (! defined('POSTEXPIRATOR_LOADED')) {
811
  return false;
812
  }
813
 
814
- if (is_null(get_post($id))) {
 
 
815
  if (POSTEXPIRATOR_DEBUG) {
816
  $debug->save(array('message' => $id . ' -> Post does not exist - exiting'));
817
  }
@@ -882,6 +886,7 @@ if (! defined('POSTEXPIRATOR_LOADED')) {
882
 
883
  // Do Work
884
  if ($expireType === 'draft') {
 
885
  if (wp_update_post(array('ID' => $id, 'post_status' => 'draft')) === 0) {
886
  if (POSTEXPIRATOR_DEBUG) {
887
  $debug->save(array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postExpireOptions, true)));
@@ -903,6 +908,8 @@ if (! defined('POSTEXPIRATOR_LOADED')) {
903
  );
904
  }
905
 
 
 
906
  $postWasExpired = true;
907
  }
908
  } elseif ($expireType === 'private') {
@@ -927,6 +934,8 @@ if (! defined('POSTEXPIRATOR_LOADED')) {
927
  );
928
  }
929
 
 
 
930
  $postWasExpired = true;
931
  }
932
  } elseif ($expireType === 'delete') {
4
  * Plugin URI: http://wordpress.org/extend/plugins/post-expirator/
5
  * Description: Allows you to add an expiration date (minute) to posts which you can configure to either delete the post, change it to a draft, or update the post categories at expiration time.
6
  * Author: PublishPress
7
+ * Version: 2.7.6
8
  * Author URI: http://publishpress.com
9
  * Text Domain: post-expirator
10
  * Domain Path: /languages
27
 
28
  if (! defined('POSTEXPIRATOR_LOADED')) {
29
  // Default Values
30
+ define('POSTEXPIRATOR_VERSION', '2.7.6');
31
  define('POSTEXPIRATOR_DATEFORMAT', __('l F jS, Y', 'post-expirator'));
32
  define('POSTEXPIRATOR_TIMEFORMAT', __('g:ia', 'post-expirator'));
33
  define('POSTEXPIRATOR_FOOTERCONTENTS', __('Post expires at EXPIRATIONTIME on EXPIRATIONDATE', 'post-expirator'));
801
 
802
  $id = (int)$id;
803
 
804
+ if (POSTEXPIRATOR_DEBUG) {
805
+ $debug->save(array('message' => 'Called postexpirator_expire_post with id=' . $id));
806
+ }
807
 
808
  if (empty($id)) {
809
  if (POSTEXPIRATOR_DEBUG) {
813
  return false;
814
  }
815
 
816
+ $post = get_post($id);
817
+
818
+ if (is_null($post)) {
819
  if (POSTEXPIRATOR_DEBUG) {
820
  $debug->save(array('message' => $id . ' -> Post does not exist - exiting'));
821
  }
886
 
887
  // Do Work
888
  if ($expireType === 'draft') {
889
+ // TODO: fix this, because wp_update_post returns int or WP_ERROR, not 0. Check other places doing the same.
890
  if (wp_update_post(array('ID' => $id, 'post_status' => 'draft')) === 0) {
891
  if (POSTEXPIRATOR_DEBUG) {
892
  $debug->save(array('message' => $id . ' -> FAILED ' . $expireType . ' ' . print_r($postExpireOptions, true)));
908
  );
909
  }
910
 
911
+ wp_transition_post_status('draft', $post->post_status, $post);
912
+
913
  $postWasExpired = true;
914
  }
915
  } elseif ($expireType === 'private') {
934
  );
935
  }
936
 
937
+ wp_transition_post_status('private', $post->post_status, $post);
938
+
939
  $postWasExpired = true;
940
  }
941
  } elseif ($expireType === 'delete') {
readme.txt CHANGED
@@ -5,7 +5,7 @@ Author URI: https://publishpress.com
5
  Tags: expire, posts, pages, schedule
6
  Requires at least: 5.3
7
  Tested up to: 6.0
8
- Stable tag: 2.7.5
9
 
10
  Add an expiration date to posts. When your post is automatically unpublished, you can delete the post, change the status, or update the post categories.
11
 
@@ -81,6 +81,10 @@ This section describes how to install the plugin and get it working.
81
 
82
  == Changelog ==
83
 
 
 
 
 
84
  = [2.7.5] - 09 Jun, 2022 =
85
 
86
  * FIXED: Fix undefined array key "hook_suffix" warning, #259;
5
  Tags: expire, posts, pages, schedule
6
  Requires at least: 5.3
7
  Tested up to: 6.0
8
+ Stable tag: 2.7.6
9
 
10
  Add an expiration date to posts. When your post is automatically unpublished, you can delete the post, change the status, or update the post categories.
11
 
81
 
82
  == Changelog ==
83
 
84
+ = [2.7.6] - 13 Jun, 2022 =
85
+
86
+ * FIXED: Fix fatal error on cron if debug is not activated, #265;
87
+
88
  = [2.7.5] - 09 Jun, 2022 =
89
 
90
  * FIXED: Fix undefined array key "hook_suffix" warning, #259;
vendor/composer/installed.php CHANGED
@@ -5,7 +5,7 @@
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
- 'reference' => '01ad0a2423e306e4401d57279d2c34ed02add9e6',
9
  'name' => 'publishpress/publishpress-future',
10
  'dev' => false,
11
  ),
@@ -16,7 +16,7 @@
16
  'type' => 'wordpress-plugin',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
- 'reference' => '01ad0a2423e306e4401d57279d2c34ed02add9e6',
20
  'dev_requirement' => false,
21
  ),
22
  'publishpress/publishpress-instance-protection' => array(
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
+ 'reference' => 'd594345b206ee3cc0a9de04062c571300e6d4ef9',
9
  'name' => 'publishpress/publishpress-future',
10
  'dev' => false,
11
  ),
16
  'type' => 'wordpress-plugin',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
+ 'reference' => 'd594345b206ee3cc0a9de04062c571300e6d4ef9',
20
  'dev_requirement' => false,
21
  ),
22
  'publishpress/publishpress-instance-protection' => array(