From bf6b976d4336b738e641b43d25f020db367d5d7c Mon Sep 17 00:00:00 2001 From: omarkasem Date: Mon, 6 Jan 2025 11:58:41 +0200 Subject: [PATCH 1/3] Adds approval status to export entries conditional logic --- includes/class-gravityview-entry-approval.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/includes/class-gravityview-entry-approval.php b/includes/class-gravityview-entry-approval.php index ed0ec057e..570148dbc 100644 --- a/includes/class-gravityview-entry-approval.php +++ b/includes/class-gravityview-entry-approval.php @@ -58,6 +58,43 @@ private function add_hooks() { add_action( 'gravityview/approve_entries/updated', array( $this, '_trigger_notifications' ) ); add_action( 'check_admin_referer', [ $this, 'resend_gf_notifications' ], 10, 2 ); + + add_filter( 'gform_field_filters', [ $this, 'add_approval_field_filter' ], 10, 2 ); + + } + + /** + * Add approval status filter to the filter list (Export entries conditional logic) + * + * @since TBD + * + * @param array $filters The existing filters. + * @param array $form The form array. + * @return array The modified filters. + */ + public function add_approval_field_filter( $filters, $form ) { + $filters[] = array( + 'key' => 'is_approved', + 'text' => __( 'Approval Status', 'gk-gravityview' ), + 'preventMultiple' => false, + 'operators' => array( 'is' ), + 'values' => array( + array( + 'value' => '1', + 'text' => __( 'Approved', 'gk-gravityview' ), + ), + array( + 'value' => '2', + 'text' => __( 'Disapproved', 'gk-gravityview' ), + ), + array( + 'value' => '3', + 'text' => __( 'Unapproved', 'gk-gravityview' ), + ), + ), + ); + + return $filters; } /** From 065cccf608d7829807824f995c5ff66001db32a8 Mon Sep 17 00:00:00 2001 From: Vlad Date: Wed, 8 Jan 2025 12:30:39 -0500 Subject: [PATCH 2/3] Remove unused variable/format code and docblocks --- includes/class-gravityview-entry-approval.php | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/includes/class-gravityview-entry-approval.php b/includes/class-gravityview-entry-approval.php index 570148dbc..2ee2c087d 100644 --- a/includes/class-gravityview-entry-approval.php +++ b/includes/class-gravityview-entry-approval.php @@ -59,40 +59,41 @@ private function add_hooks() { add_action( 'check_admin_referer', [ $this, 'resend_gf_notifications' ], 10, 2 ); - add_filter( 'gform_field_filters', [ $this, 'add_approval_field_filter' ], 10, 2 ); + add_filter( 'gform_field_filters', [ $this, 'add_approval_field_filter' ] ); } /** - * Add approval status filter to the filter list (Export entries conditional logic) + * Adds approval status filter to the filter list (Export Entries conditional logic). * * @since TBD * * @param array $filters The existing filters. - * @param array $form The form array. + * @param array $form The form array. + * * @return array The modified filters. */ - public function add_approval_field_filter( $filters, $form ) { - $filters[] = array( - 'key' => 'is_approved', - 'text' => __( 'Approval Status', 'gk-gravityview' ), - 'preventMultiple' => false, - 'operators' => array( 'is' ), - 'values' => array( - array( + public function add_approval_field_filter( $filters ) { + $filters[] = [ + 'key' => 'is_approved', + 'text' => esc_html__( 'Approval Status', 'gk-gravityview' ), + 'preventMultiple' => false, + 'operators' => [ 'is' ], + 'values' => [ + [ 'value' => '1', - 'text' => __( 'Approved', 'gk-gravityview' ), - ), - array( + 'text' => esc_html__( 'Approved', 'gk-gravityview' ), + ], + [ 'value' => '2', - 'text' => __( 'Disapproved', 'gk-gravityview' ), - ), - array( + 'text' => esc_html__( 'Disapproved', 'gk-gravityview' ), + ], + [ 'value' => '3', - 'text' => __( 'Unapproved', 'gk-gravityview' ), - ), - ), - ); + 'text' => esc_html__( 'Unapproved', 'gk-gravityview' ), + ], + ], + ]; return $filters; } From 31e18fef94d954f1a7ef40ba194d76a65465e027 Mon Sep 17 00:00:00 2001 From: Vlad Date: Wed, 8 Jan 2025 12:46:17 -0500 Subject: [PATCH 3/3] Update changelog [ci skip] --- readme.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/readme.txt b/readme.txt index d8205b3aa..92f2c9543 100644 --- a/readme.txt +++ b/readme.txt @@ -23,6 +23,9 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h = develop = +#### 🚀 Added +* Support for entry approval statuses in conditional logic on the Gravity Forms Export Entries page. + #### 🐛 Fixed * Fatal error when searching entries by approval status in Views joined with another form using the Multiple Forms extension. * Some merge tag modifiers (e.g., `maxwords`) were not being processed.