| @@ -39,17 +39,28 @@ | ||
| 39 | 39 | learn_press_get_template( 'checkout/account-logged-in' ); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function account_login() { |
| 43 | - if ( is_user_logged_in() || ! LearnPress::instance()->checkout()->is_enable_login() ) { | |
| 43 | + $checkout = LearnPress::instance()->checkout(); | |
| 44 | + | |
| 45 | + if ( is_user_logged_in() | |
| 46 | + || ! $checkout->is_enable_login() | |
| 47 | + || ( $checkout->is_enable_guest_checkout() && ! isset( $_GET['is_form_login'] ) ) ) { | |
| 44 | 48 | return; |
| 45 | 49 | } |
| 46 | 50 | |
| 51 | + if ( isset( $_GET['is_form_register'] ) ) { | |
| 52 | + return; | |
| 53 | + } | |
| 54 | + | |
| 47 | 55 | learn_press_get_template( 'checkout/account-login' ); |
| 48 | 56 | } |
| 49 | 57 | |
| 50 | 58 | public function account_register() { |
| 51 | - if ( is_user_logged_in() || ! LearnPress::instance()->checkout()->is_enable_register() ) { | |
| 59 | + if ( is_user_logged_in() | |
| 60 | + || ! LearnPress::instance()->checkout()->is_enable_register() | |
| 61 | + || isset( $_GET['is_form_login'] ) | |
| 62 | + || ! isset( $_GET['is_form_register'] ) ) { | |
| 52 | 63 | return; |
| 53 | 64 | } |
| 54 | 65 | |
| 55 | 66 | learn_press_get_template( 'checkout/account-register' ); |
| @@ -55,9 +66,13 @@ | ||
| 55 | 66 | learn_press_get_template( 'checkout/account-register' ); |
| 56 | 67 | } |
| 57 | 68 | |
| 58 | 69 | public function guest_checkout() { |
| 59 | - if ( is_user_logged_in() || ! LearnPress::instance()->checkout()->is_enable_guest_checkout() ) { | |
| 70 | + $is_account_form = isset( $_GET['is_form_login'] ) || isset( $_GET['is_form_register'] ); | |
| 71 | + | |
| 72 | + if ( is_user_logged_in() | |
| 73 | + || ! LearnPress::instance()->checkout()->is_enable_guest_checkout() | |
| 74 | + || $is_account_form ) { | |
| 60 | 75 | return; |
| 61 | 76 | } |
| 62 | 77 | |
| 63 | 78 | learn_press_get_template( 'checkout/guest-checkout' ); |