From 59d65099d0b3b1e293ebcda4ea7283e60b550ae1 Mon Sep 17 00:00:00 2001 From: Karl Potter Date: Tue, 23 Jul 2019 18:55:32 -0400 Subject: [PATCH 1/4] Fix entry export status --- includes/class-gf-cli-entry.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/includes/class-gf-cli-entry.php b/includes/class-gf-cli-entry.php index 023fba9..2abc881 100644 --- a/includes/class-gf-cli-entry.php +++ b/includes/class-gf-cli-entry.php @@ -451,6 +451,10 @@ public function update( $args, $assoc_args ) { * [--dir=] * : The directory to write the file. Defaults to the current working directory. * + * [--status=] + * : The status of the entries. Default: active + * Accepted values: trash, active + * * Examples * --filename=entries.json * --filename=entries.csv @@ -461,7 +465,7 @@ public function update( $args, $assoc_args ) { * wp gf entry export 1 --format=json * wp gf entry export 1 --format=csv --start_date="2018-01-01" --end_date="2018-03-25" * - * @synopsis [] [--dir=] [--format=] [--start_date=] [--end_date=] + * @synopsis [] [--dir=] [--format=] [--start_date=] [--end_date=] [--status=] */ public function export( $args, $assoc_args ) { // Check is the form ID was defined. @@ -508,8 +512,15 @@ public function export( $args, $assoc_args ) { } } + // Default entry status to active if no status flag is set. + if ( ! isset( $assoc_args['status'] ) ) { + $assoc_args['status'] = 'active'; + } + $search_criteria = array(); + $search_criteria['status'] = $assoc_args['status']; + // Check to see if start date and end date are set to add to search_criteria if ( isset ( $assoc_args['start_date'] ) ) { $search_criteria['start_date'] = $assoc_args['start_date']; @@ -931,8 +942,6 @@ private function export_entries_csv( $form, $filename, $search_criteria = array( $_POST['export_field'] = $fields; - $search_criteria['status'] = 'status'; - if ( isset( $search_criteria['start_date'] ) ) { $_POST['export_date_start'] = $search_criteria['start_date']; } From a2eccc013f8f951f92f826702a8a1a14962cbad0 Mon Sep 17 00:00:00 2001 From: Karl Potter Date: Mon, 5 Aug 2019 17:56:11 -0400 Subject: [PATCH 2/4] Revert "Fix entry export status" This reverts commit 59d65099d0b3b1e293ebcda4ea7283e60b550ae1. --- includes/class-gf-cli-entry.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/includes/class-gf-cli-entry.php b/includes/class-gf-cli-entry.php index 2abc881..023fba9 100644 --- a/includes/class-gf-cli-entry.php +++ b/includes/class-gf-cli-entry.php @@ -451,10 +451,6 @@ public function update( $args, $assoc_args ) { * [--dir=] * : The directory to write the file. Defaults to the current working directory. * - * [--status=] - * : The status of the entries. Default: active - * Accepted values: trash, active - * * Examples * --filename=entries.json * --filename=entries.csv @@ -465,7 +461,7 @@ public function update( $args, $assoc_args ) { * wp gf entry export 1 --format=json * wp gf entry export 1 --format=csv --start_date="2018-01-01" --end_date="2018-03-25" * - * @synopsis [] [--dir=] [--format=] [--start_date=] [--end_date=] [--status=] + * @synopsis [] [--dir=] [--format=] [--start_date=] [--end_date=] */ public function export( $args, $assoc_args ) { // Check is the form ID was defined. @@ -512,15 +508,8 @@ public function export( $args, $assoc_args ) { } } - // Default entry status to active if no status flag is set. - if ( ! isset( $assoc_args['status'] ) ) { - $assoc_args['status'] = 'active'; - } - $search_criteria = array(); - $search_criteria['status'] = $assoc_args['status']; - // Check to see if start date and end date are set to add to search_criteria if ( isset ( $assoc_args['start_date'] ) ) { $search_criteria['start_date'] = $assoc_args['start_date']; @@ -942,6 +931,8 @@ private function export_entries_csv( $form, $filename, $search_criteria = array( $_POST['export_field'] = $fields; + $search_criteria['status'] = 'status'; + if ( isset( $search_criteria['start_date'] ) ) { $_POST['export_date_start'] = $search_criteria['start_date']; } From e38ca1f137e73629cb4cdf3a52b16a5feb070e3d Mon Sep 17 00:00:00 2001 From: Karl Potter Date: Mon, 5 Aug 2019 18:06:53 -0400 Subject: [PATCH 3/4] Fix entry status in search criteria --- includes/class-gf-cli-entry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-gf-cli-entry.php b/includes/class-gf-cli-entry.php index 023fba9..d5eb45a 100644 --- a/includes/class-gf-cli-entry.php +++ b/includes/class-gf-cli-entry.php @@ -931,7 +931,7 @@ private function export_entries_csv( $form, $filename, $search_criteria = array( $_POST['export_field'] = $fields; - $search_criteria['status'] = 'status'; + $search_criteria['status'] = 'active'; if ( isset( $search_criteria['start_date'] ) ) { $_POST['export_date_start'] = $search_criteria['start_date']; From 07769f28ee7a33732e8a7da36e394cdcbcefad15 Mon Sep 17 00:00:00 2001 From: Karl Potter Date: Tue, 6 Aug 2019 13:18:41 -0400 Subject: [PATCH 4/4] Bump version; fix typo in readme --- README.md | 2 +- cli.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6d6de68..671a043 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,6 @@ Requirements Support ------- -If you find any that needs fixing, or if you have any ideas for improvements, please submit a support ticket: +If you find anything that needs fixing, or if you have any ideas for improvements, please open a support ticket: https://www.gravityforms.com/open-support-ticket/ diff --git a/cli.php b/cli.php index 577a4b0..faa698d 100644 --- a/cli.php +++ b/cli.php @@ -3,7 +3,7 @@ Plugin Name: Gravity Forms CLI Plugin URI: http://www.gravityforms.com Description: Manage Gravity Forms with the WP CLI. -Version: 1.1 +Version: 1.1.1 Author: Rocketgenius Author URI: http://www.gravityforms.com License: GPL-2.0+ @@ -30,7 +30,7 @@ defined( 'ABSPATH' ) || die(); // Defines the current version of the CLI add-on -define( 'GF_CLI_VERSION', '1.1' ); +define( 'GF_CLI_VERSION', '1.1.1' ); define( 'GF_CLI_MIN_GF_VERSION', '1.9.17.8' );