class-captcha-protection.php
| 1 | <?php |
| 2 | |
| 3 | namespace ASENHA\Classes; |
| 4 | |
| 5 | /** |
| 6 | * Class for Redirect After Login module |
| 7 | * |
| 8 | * @since 6.9.5 |
| 9 | */ |
| 10 | class CAPTCHA_Protection { |
| 11 | |
| 12 | /** |
| 13 | * Maybe keep original redirect |
| 14 | * |
| 15 | * @since 7.8.0 |
| 16 | */ |
| 17 | public function maybe_keep_original_redirect( $username, $user ) { |
| 18 | // Skip redirection if login is performed from a WooCommerce checkout page |
| 19 | // This will ensure user is redirected back to the checkout page after successful login |
| 20 | if ( isset( $_REQUEST['woocommerce-login-nonce'] ) |
| 21 | && wc_get_checkout_url() == $_REQUEST['redirect'] |
| 22 | ) { |
| 23 | wp_safe_redirect( wc_get_checkout_url() ); |
| 24 | exit(); |
| 25 | } |
| 26 | } |
| 27 | } |