From a5135abb567163e414c0444e0f58ed5b6fb52fa7 Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Mon, 31 Mar 2025 15:32:11 -0300 Subject: [PATCH 1/3] Fix wpml compatibility issue --- classes/controllers/FrmFormActionsController.php | 16 ++++++++++++++++ classes/controllers/FrmHooksController.php | 1 + 2 files changed, 17 insertions(+) diff --git a/classes/controllers/FrmFormActionsController.php b/classes/controllers/FrmFormActionsController.php index 9aeeb64472..cdeeaf95f3 100644 --- a/classes/controllers/FrmFormActionsController.php +++ b/classes/controllers/FrmFormActionsController.php @@ -693,4 +693,20 @@ public function _register_actions() { } } } + + /** + * Prevent WPML from filtering form actions based on the active language. + * + * @since x.x + * + * @param bool|null $null + * @param string $post_type + * @return bool|null + */ + public static function prevent_wpml_translations( $null, $post_type ) { + if ( 'frm_form_actions' === $post_type ) { + return false; + } + return $null; + } } diff --git a/classes/controllers/FrmHooksController.php b/classes/controllers/FrmHooksController.php index 8d336066e4..81ab03dc34 100644 --- a/classes/controllers/FrmHooksController.php +++ b/classes/controllers/FrmHooksController.php @@ -72,6 +72,7 @@ public static function load_hooks() { // Form Actions Controller. add_action( 'init', 'FrmFormActionsController::register_post_types', 1 ); add_action( 'frm_after_create_entry', 'FrmFormActionsController::trigger_create_actions', 20, 3 ); + add_filter( 'pre_wpml_is_translated_post_type', 'FrmFormActionsController::prevent_wpml_translations', 10, 2 ); // Forms Controller. add_action( 'widgets_init', 'FrmFormsController::register_widgets' ); From 2fe90bad23c669cf0a61877b1d2f6c01a570dfd6 Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Mon, 31 Mar 2025 15:50:07 -0300 Subject: [PATCH 2/3] Fix function in wrong class --- .../controllers/FrmFormActionsController.php | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/classes/controllers/FrmFormActionsController.php b/classes/controllers/FrmFormActionsController.php index cdeeaf95f3..fe3d03d470 100644 --- a/classes/controllers/FrmFormActionsController.php +++ b/classes/controllers/FrmFormActionsController.php @@ -664,6 +664,22 @@ public static function limit_by_type( $where ) { return $where; } + + /** + * Prevent WPML from filtering form actions based on the active language. + * + * @since x.x + * + * @param bool|null $null + * @param string $post_type + * @return bool|null + */ + public static function prevent_wpml_translations( $null, $post_type ) { + if ( 'frm_form_actions' === $post_type ) { + return false; + } + return $null; + } } class Frm_Form_Action_Factory { @@ -693,20 +709,4 @@ public function _register_actions() { } } } - - /** - * Prevent WPML from filtering form actions based on the active language. - * - * @since x.x - * - * @param bool|null $null - * @param string $post_type - * @return bool|null - */ - public static function prevent_wpml_translations( $null, $post_type ) { - if ( 'frm_form_actions' === $post_type ) { - return false; - } - return $null; - } } From 15d3e50cde6cb0d0c41718ee9d3b935e9fb6d24b Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Mon, 31 Mar 2025 16:01:18 -0300 Subject: [PATCH 3/3] Stop hard coding it --- classes/controllers/FrmFormActionsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/controllers/FrmFormActionsController.php b/classes/controllers/FrmFormActionsController.php index fe3d03d470..06caa33e22 100644 --- a/classes/controllers/FrmFormActionsController.php +++ b/classes/controllers/FrmFormActionsController.php @@ -675,7 +675,7 @@ public static function limit_by_type( $where ) { * @return bool|null */ public static function prevent_wpml_translations( $null, $post_type ) { - if ( 'frm_form_actions' === $post_type ) { + if ( self::$action_post_type === $post_type ) { return false; } return $null;