← All changes
|
includes/elementor/modules/optin/actions/utils/ajax-handler.php
+12
-2
1.7.2
→
2.7.0
View file →
| @@ -76,15 +76,25 @@ | ||
| 76 | 76 | |
| 77 | 77 | return; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - $post_id = filter_input( INPUT_POST, 'post_id' ); | |
| 81 | - $form_id = filter_input( INPUT_POST, 'form_id' ); | |
| 80 | + $post_id = filter_input( INPUT_POST, 'post_id' ); | |
| 81 | + $form_id = filter_input( INPUT_POST, 'form_id' ); | |
| 82 | + $funnel_page_id = filter_input( INPUT_POST, 'sellkit_current_page_id', FILTER_SANITIZE_NUMBER_INT ); | |
| 82 | 83 | |
| 83 | 84 | $this->form_data = $_POST; // @codingStandardsIgnoreLine |
| 84 | 85 | |
| 85 | 86 | $post_elements = Elementor::$instance->documents->get( $post_id )->get_elements_data(); |
| 86 | 87 | $this->form = self::find_form_recursive( $post_elements, $form_id ); |
| 88 | + $funnel = Sellkit_Funnel::get_instance( $funnel_page_id ); | |
| 89 | + | |
| 90 | + if ( 'sales-page' === $funnel->current_step_data['type']['key'] ) { | |
| 91 | + $this | |
| 92 | + ->add_response( 'errors', esc_html__( 'Opt-in widget should not be used in the sales page step.', 'sellkit' ) ) | |
| 93 | + ->set_success( false ); | |
| 94 | + | |
| 95 | + wp_send_json_error( $this->response ); | |
| 96 | + } | |
| 87 | 97 | |
| 88 | 98 | $this |
| 89 | 99 | ->validate_form() |
| 90 | 100 | ->fill_form_settings() |