| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace JFB_Modules\Verification\Events\Verification_Failed; |
| 5 |
|
| 6 |
// If this file is called directly, abort. |
| 7 |
if ( ! defined( 'WPINC' ) ) { |
| 8 |
die; |
| 9 |
} |
| 10 |
|
| 11 |
use Jet_Form_Builder\Actions\Events\Base_Executor; |
| 12 |
use Jet_Form_Builder\Actions\Types\Base; |
| 13 |
use JFB_Modules\Verification\Actions\Verification; |
| 14 |
|
| 15 |
class Executor extends Base_Executor { |
| 16 |
|
| 17 |
public function is_supported(): bool { |
| 18 |
return true; |
| 19 |
} |
| 20 |
|
| 21 |
public function before_execute() { |
| 22 |
parent::before_execute(); |
| 23 |
|
| 24 |
$verification = jet_fb_action_handler()->get_action( Verification::class ); |
| 25 |
|
| 26 |
if ( ! is_a( $verification, Verification::class ) ) { |
| 27 |
return; |
| 28 |
} |
| 29 |
|
| 30 |
$failed_page = absint( $verification->settings['failed_page'] ?? 0 ); |
| 31 |
$url = get_permalink( $failed_page ); |
| 32 |
|
| 33 |
if ( ! $url ) { |
| 34 |
return; |
| 35 |
} |
| 36 |
|
| 37 |
jet_fb_action_handler()->response_data['redirect'] = $url; |
| 38 |
} |
| 39 |
|
| 40 |
} |
| 41 |
|