From 9f562d830e4fb97254d9ab2cbfee16c411153a80 Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Tue, 14 Jan 2025 16:35:11 -0400 Subject: [PATCH 1/7] Fix payments lists empty when inbox count is displayed --- .../FrmStrpLiteHooksController.php | 4 ++ .../FrmTransLiteHooksController.php | 37 +++++++++++++++++++ .../FrmTransLiteListsController.php | 9 ++++- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/stripe/controllers/FrmStrpLiteHooksController.php b/stripe/controllers/FrmStrpLiteHooksController.php index a7561acae9..2c9ed9ffea 100644 --- a/stripe/controllers/FrmStrpLiteHooksController.php +++ b/stripe/controllers/FrmStrpLiteHooksController.php @@ -53,6 +53,10 @@ function ( $form_col ) { add_action( 'frm_form_classes', 'FrmStrpLiteLinkController::add_form_classes' ); } + public static function remove_screen_options() { + return false; + } + /** * @return void */ diff --git a/stripe/controllers/FrmTransLiteHooksController.php b/stripe/controllers/FrmTransLiteHooksController.php index 0009020ed7..50a200d78e 100755 --- a/stripe/controllers/FrmTransLiteHooksController.php +++ b/stripe/controllers/FrmTransLiteHooksController.php @@ -34,6 +34,13 @@ public static function load_hooks() { * @return void */ public static function load_admin_hooks() { + add_action( + 'admin_init', + function() { + self::fix_addon_hooks(); + } + ); + if ( class_exists( 'FrmTransHooksController', false ) ) { // Exit early, let the Payments submodule handle everything. return; @@ -57,4 +64,34 @@ private static function load_ajax_hooks() { add_action( 'wp_ajax_frm_trans_refund', 'FrmTransLitePaymentsController::refund_payment' ); add_action( 'wp_ajax_frm_trans_cancel', 'FrmTransLiteSubscriptionsController::cancel_subscription' ); } + + /** + * Make sure that Payments appear when there are inbox items for all Payments plugins. + * + * @since x.x + * + * @return void + */ + private static function fix_addon_hooks() { + $unread_count = FrmEntriesHelper::get_visible_unread_inbox_count(); + if ( ! $unread_count ) { + // Nothing to fix. + return; + } + + $menu_name = FrmAppHelper::get_menu_name(); + $hook_name = 'manage_' . sanitize_title( $menu_name ) . '-' . $unread_count . '_page_formidable-payments_columns'; + + if ( FrmTransLiteAppHelper::should_fallback_to_paypal() && is_callable( 'FrmPaymentsController::payment_columns' ) ) { + // Fallback to PayPal add-on. + add_filter( $hook_name, 'FrmPaymentsController::payment_columns' ); + } elseif ( is_callable( 'FrmTransListsController::payment_columns' ) ) { + // Fallback to the Payments submodule. + add_filter( $hook_name, 'FrmTransListsController::payment_columns' ); + } else { + return; + } + + add_filter( 'screen_options_show_screen', 'FrmTransLiteListsController::remove_screen_options', 10, 2 ); + } } diff --git a/stripe/controllers/FrmTransLiteListsController.php b/stripe/controllers/FrmTransLiteListsController.php index 5ea36073ca..19c9820651 100755 --- a/stripe/controllers/FrmTransLiteListsController.php +++ b/stripe/controllers/FrmTransLiteListsController.php @@ -13,7 +13,8 @@ public static function add_list_hooks() { return; } - $hook_name = 'manage_' . sanitize_title( FrmAppHelper::get_menu_name() ) . '_page_formidable-payments_columns'; + $unread_count = FrmEntriesHelper::get_visible_unread_inbox_count(); + $hook_name = 'manage_' . sanitize_title( FrmAppHelper::get_menu_name() ) . ( $unread_count ? '-' . $unread_count : '' ) . '_page_formidable-payments_columns'; add_filter( $hook_name, __CLASS__ . '::payment_columns' ); add_filter( 'screen_options_show_screen', __CLASS__ . '::remove_screen_options', 10, 2 ); } @@ -91,6 +92,12 @@ public static function remove_screen_options( $show_screen, $screen ) { } $menu_name = sanitize_title( FrmAppHelper::get_menu_name() ); + + $unread_count = FrmEntriesHelper::get_visible_unread_inbox_count(); + if ( $unread_count ) { + $menu_name .= '-' . $unread_count; + } + if ( $screen->id === $menu_name . '_page_formidable-payments' ) { $show_screen = false; } From 2bce23a2824a94f0147bd014b97caacf2b33edcd Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Tue, 14 Jan 2025 16:35:52 -0400 Subject: [PATCH 2/7] Align equals --- stripe/controllers/FrmTransLiteListsController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stripe/controllers/FrmTransLiteListsController.php b/stripe/controllers/FrmTransLiteListsController.php index 19c9820651..ed2474c528 100755 --- a/stripe/controllers/FrmTransLiteListsController.php +++ b/stripe/controllers/FrmTransLiteListsController.php @@ -14,7 +14,8 @@ public static function add_list_hooks() { } $unread_count = FrmEntriesHelper::get_visible_unread_inbox_count(); - $hook_name = 'manage_' . sanitize_title( FrmAppHelper::get_menu_name() ) . ( $unread_count ? '-' . $unread_count : '' ) . '_page_formidable-payments_columns'; + $hook_name = 'manage_' . sanitize_title( FrmAppHelper::get_menu_name() ) . ( $unread_count ? '-' . $unread_count : '' ) . '_page_formidable-payments_columns'; + add_filter( $hook_name, __CLASS__ . '::payment_columns' ); add_filter( 'screen_options_show_screen', __CLASS__ . '::remove_screen_options', 10, 2 ); } From 0bbb2b0f4d32d250e15e058cc2cad95c2423e9ee Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Tue, 14 Jan 2025 16:36:27 -0400 Subject: [PATCH 3/7] Remove unused function --- stripe/controllers/FrmStrpLiteHooksController.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/stripe/controllers/FrmStrpLiteHooksController.php b/stripe/controllers/FrmStrpLiteHooksController.php index 2c9ed9ffea..a7561acae9 100644 --- a/stripe/controllers/FrmStrpLiteHooksController.php +++ b/stripe/controllers/FrmStrpLiteHooksController.php @@ -53,10 +53,6 @@ function ( $form_col ) { add_action( 'frm_form_classes', 'FrmStrpLiteLinkController::add_form_classes' ); } - public static function remove_screen_options() { - return false; - } - /** * @return void */ From e238b7785d10ef09dbff3d9e2d539a93119705cf Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Tue, 14 Jan 2025 16:41:47 -0400 Subject: [PATCH 4/7] Add missing stubs --- stubs.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/stubs.php b/stubs.php index eaeb99386f..b73c1a1b16 100644 --- a/stubs.php +++ b/stubs.php @@ -402,6 +402,22 @@ function WP_Optimize() { */ function w3tc_flush_all( $extras = null ) { } + class FrmPaymentsController { + /** + * @param array $cols + * @return array + */ + public static function payment_columns( $cols = array() ) { + } + } + class FrmTransListsController { + /** + * @param array $columns + * @return array + */ + public static function payment_columns( $columns = array() ) { + } + } } namespace Elementor { From c52514c661352fa990cd07e6e422176bfc48a934 Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Tue, 14 Jan 2025 16:43:58 -0400 Subject: [PATCH 5/7] Fix stub --- stubs.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/stubs.php b/stubs.php index b73c1a1b16..bce0038996 100644 --- a/stubs.php +++ b/stubs.php @@ -321,6 +321,12 @@ public function __construct( $exceptions = null ) { } class FrmPaymentsController { public static $db_opt_name = 'frm_pay_db_version'; + /** + * @param array $cols + * @return array + */ + public static function payment_columns( $cols = array() ) { + } } class FrmProDashboardHelper { /** @@ -402,14 +408,6 @@ function WP_Optimize() { */ function w3tc_flush_all( $extras = null ) { } - class FrmPaymentsController { - /** - * @param array $cols - * @return array - */ - public static function payment_columns( $cols = array() ) { - } - } class FrmTransListsController { /** * @param array $columns From 8ce01d1aba2a0b2344941e11a95aee89f3dc76da Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Tue, 14 Jan 2025 16:44:32 -0400 Subject: [PATCH 6/7] phpcs fix --- stripe/controllers/FrmTransLiteHooksController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stripe/controllers/FrmTransLiteHooksController.php b/stripe/controllers/FrmTransLiteHooksController.php index 50a200d78e..188253dc16 100755 --- a/stripe/controllers/FrmTransLiteHooksController.php +++ b/stripe/controllers/FrmTransLiteHooksController.php @@ -36,7 +36,7 @@ public static function load_hooks() { public static function load_admin_hooks() { add_action( 'admin_init', - function() { + function () { self::fix_addon_hooks(); } ); From 56c047e48ca5078424c0138210242acddd0f2b39 Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Tue, 14 Jan 2025 16:49:46 -0400 Subject: [PATCH 7/7] Add readme changes, update since version --- changelog.txt | 3 +++ readme.txt | 20 ++++--------------- .../FrmTransLiteHooksController.php | 2 +- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/changelog.txt b/changelog.txt index ef16753597..55673cc87a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,7 @@ == Changelog == += 6.17.1 = +* Fix: The payments table admin page would appear empty when there were unread inbox notices. + = 6.17 = * New: New redirect delay duration and delay message settings have been added to confirmation actions. * New: A new UTF-8 with BOM format option has been added when exporting entries as CSV. diff --git a/readme.txt b/readme.txt index 85adc7ef9c..dbb74db208 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: forms, form builder, survey, payment form, custom form, contact form, form Requires at least: 5.2 Tested up to: 6.7.1 Requires PHP: 7.0 -Stable tag: 6.17 +Stable tag: 6.17.1 The most advanced WordPress forms plugin. Go beyond contact forms with our drag and drop form builder for surveys, quizzes, and more. @@ -371,6 +371,9 @@ Using our Zapier integration, you can easily connect your website with over 5,00 See all [Formidable Zapier Integrations](https://zapier.com/apps/formidable/integrations). == Changelog == += 6.17.1 = +* Fix: The payments table admin page would appear empty when there were unread inbox notices. + = 6.17 = * New: New redirect delay duration and delay message settings have been added to confirmation actions. * New: A new UTF-8 with BOM format option has been added when exporting entries as CSV. @@ -403,21 +406,6 @@ See all [Formidable Zapier Integrations](https://zapier.com/apps/formidable/inte * Security: Additional context checks and filtering have been added to prevent posted script data from appearing inside of fields. * Fix: JSON default values are no longer decoded for field types that expect string values only. -= 6.16.1 = -* New: Database queries for entry ID data have been optimized, removing a JOIN in cases where it is not required. This should significantly improve performance when searching for entries in a View. -* Fix: Collapsible sections in the styler settings would no longer open after the recent WordPress 6.7 update. -* Fix: The label position setting and CSS layout classes for summary fields were not working. Since None is also the default value for Summary field label positions, this means that Summary field labels that previously were visible likely are no longer visible. -* Fix: The slider to set field margin for section fields wouldn't properly save. -* Fix: Checkbox selection would not work on iPhones when using frm_grid classes. -* Fix: An automatic conversion of false to array deprecated message that would occur when loading the visual styler with the Authorize.Net add-on active has been fixed. -* Fix: A str_replace(): Passing null to parameter #3 deprecated message has been fixed. -* Fix: Stripe payments using the action included in this plugin would fail to initialize when using shortcode amount values for many currency types including Mexican Pesos. -* Fix: An array to string conversion PHP warning has been fixed. -* Fix: The center form styling toggle would not properly save. -* Fix: Form fields would appear broken when the Payment forms by Paystack plugin was active due to a shortcode conflict. -* Several deprecated functions have been removed including FrmAppController::page_route, FrmFieldType::default_invalid_msg, FrmFieldType::default_unique_msg, FrmStylesHelper::maybe_include_font_icon_css, FrmFormsHelper::ignore_template_categories, FrmFormActionsHelper::default_action_opts, and FrmAppHelper::maybe_full_screen_link. -* The unused FrmEDD_SL_Plugin_Updater class has been deprecated and is no longer functional. - [See changelog for all versions](https://raw.githubusercontent.com/Strategy11/formidable-forms/master/changelog.txt) == Upgrade Notice == diff --git a/stripe/controllers/FrmTransLiteHooksController.php b/stripe/controllers/FrmTransLiteHooksController.php index 188253dc16..3fda1945ba 100755 --- a/stripe/controllers/FrmTransLiteHooksController.php +++ b/stripe/controllers/FrmTransLiteHooksController.php @@ -68,7 +68,7 @@ private static function load_ajax_hooks() { /** * Make sure that Payments appear when there are inbox items for all Payments plugins. * - * @since x.x + * @since 6.17.1 * * @return void */