Skip to content

Commit bc387ff

Browse files
committed
Package for release (2.2)
- Fixed entries not deleting on schedule when server and WordPress timezones do not match.
1 parent 8f2500b commit bc387ff

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

class-gf-entryexpiration.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ public function maybe_run_deletion( $form, $settings ) {
615615
public function delete_form_entries( $form, $settings ) {
616616

617617
// Prepare search critera.
618-
$search_critera = $this->get_search_criteria( $settings, $form );
618+
$search_criteria = $this->get_search_criteria( $settings, $form );
619619

620620
// Prepare paging criteria.
621621
$paging = array(
@@ -624,7 +624,7 @@ public function delete_form_entries( $form, $settings ) {
624624
);
625625

626626
// Get total entry count.
627-
$found_entries = GFAPI::count_entries( $form['id'], $search_critera );
627+
$found_entries = GFAPI::count_entries( $form['id'], $search_criteria );
628628

629629
// Set entries processed count.
630630
$entries_processed = 0;
@@ -636,7 +636,7 @@ public function delete_form_entries( $form, $settings ) {
636636
$this->log_debug( __METHOD__ . '(): Starting deletion of page ' . ( round( $entries_processed / $paging['page_size'] ) + 1 ) . ' of ' . ( round( $found_entries / $paging['page_size'] ) ) );
637637

638638
// Get entries.
639-
$entries = GFAPI::get_entries( $form['id'], $search_critera, null, $paging );
639+
$entries = GFAPI::get_entries( $form['id'], $search_criteria, null, $paging );
640640

641641
// If no more entries were found, break.
642642
if ( empty( $entries ) ) {
@@ -684,9 +684,9 @@ public function delete_form_entries( $form, $settings ) {
684684
public function get_search_criteria( $settings, $form ) {
685685

686686
// Initialize search criteria.
687-
$search_critera = array(
688-
'start_date' => date( 'Y-m-d H:i:s', 0 ),
689-
'end_date' => date( 'Y-m-d H:i:s', strtotime( '-' . $settings['deletionDate']['number'] . ' ' . $settings['deletionDate']['unit'] ) ),
687+
$search_criteria = array(
688+
'start_date' => wp_date( 'Y-m-d H:i:s', 0 ),
689+
'end_date' => wp_date( 'Y-m-d H:i:s', strtotime( '-' . $settings['deletionDate']['number'] . ' ' . $settings['deletionDate']['unit'] ) ),
690690
'payment_status' => null,
691691
);
692692

@@ -698,7 +698,7 @@ public function get_search_criteria( $settings, $form ) {
698698
* @param string $older_than Current entry expiration time.
699699
* @param array $form Form object.
700700
*/
701-
$search_critera['end_date'] = gf_apply_filters( array( 'gf_entryexpiration_older_than', $form['id'] ), $search_critera['end_date'], $form );
701+
$search_criteria['end_date'] = gf_apply_filters( array( 'gf_entryexpiration_older_than', $form['id'] ), $search_criteria['end_date'], $form );
702702

703703
/**
704704
* Set the payment status when searching for expired entries.
@@ -708,9 +708,9 @@ public function get_search_criteria( $settings, $form ) {
708708
* @param string null Payment status.
709709
* @param array $form Form object.
710710
*/
711-
$search_critera['payment_status'] = gf_apply_filters( array( 'gf_entryexpiration_payment', $form['id'] ), $search_critera['payment_status'], $form );
711+
$search_criteria['payment_status'] = gf_apply_filters( array( 'gf_entryexpiration_payment', $form['id'] ), $search_criteria['payment_status'], $form );
712712

713-
return $search_critera;
713+
return $search_criteria;
714714

715715
}
716716

entryexpiration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
Plugin Name: Entry Expiration for Gravity Forms
44
Plugin URI: https://travislop.es/plugins/gravity-forms-entry-expiration/
55
Description: Provides a simple way to remove old entries in Gravity Forms.
6-
Version: 2.1
6+
Version: 2.2
77
Author: ForGravity
88
Author URI: https://forgravity.com
99
Text Domain: gravity-forms-entry-expiration
1010
**/
1111

12-
define( 'GF_ENTRYEXPIRATION_VERSION', '2.1' );
12+
define( 'GF_ENTRYEXPIRATION_VERSION', '2.2' );
1313

1414
// If Gravity Forms is loaded, bootstrap the Entry Expiration Add-On.
1515
add_action( 'gform_loaded', array( 'GF_EntryExpiration_Bootstrap', 'load' ), 5 );

readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
This WordPress plugin allows you to automatically delete Gravity Forms entries older than a defined timeframe. After activating the plugin, set the oldest age for an entry on the Entry Expiration Settings page inside of Gravity Forms. At midnight, the plugin will delete all entries older than the time you set. Only forms set to be included in the entry expiration will have their entries deleted. You can include a form in the entry expiration process by selecting the "Include in entry expiration" option under Form Settings.
1010

1111
### Changelog
12+
* Version 2.2 (2021-09-02)
13+
* Fixed entries not deleting on schedule when server and WordPress timezones do not match.
1214
* Version 2.1 (2020-08-07)
1315
* Added capabilities.
1416
* Added support for Gravity Forms 2.5.

readme.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
=== Entry Expiration for Gravity Forms ===
22
Contributors: forgravity, travislopes
33
Tags: gravity forms, entry, expiration
4-
Requires at least: 3.9.2
4+
Requires at least: 5.3.0
55
Tested up to: 5.8.0
66
Stable tag: 4.7.3
77
Requires PHP: 5.3
@@ -23,7 +23,7 @@ Entry Expiration for Gravity Forms allows you to automatically delete Gravity Fo
2323

2424
== Installation ==
2525
= Requirements =
26-
* WordPress version 3.9.2 and later (tested at 5.8.0)
26+
* WordPress version 5.3.0 and later (tested at 5.8.0)
2727
* Gravity Forms 1.8.17 and later
2828

2929
= Installation =
@@ -34,6 +34,8 @@ Entry Expiration for Gravity Forms allows you to automatically delete Gravity Fo
3434
1. Define how often you want entries to be deleted and the minimum age required for entries to be deleted.
3535

3636
== Changelog ==
37+
= Version 2.2 (2021-09-02) =
38+
* Fixed entries not deleting on schedule when server and WordPress timezones do not match.
3739
= Version 2.1 (2020-08-07) =
3840
* Added capabilities.
3941
* Added support for Gravity Forms 2.5.

0 commit comments

Comments
 (0)