| @@ -5,27 +5,44 @@ | ||
| 5 | 5 | * This template can be overridden by copying it to yourtheme/learnpress/checkout/form.php. |
| 6 | 6 | * |
| 7 | 7 | * @author ThimPress |
| 8 | 8 | * @package Learnpress/Templates |
| 9 | - * @version 4.0.1 | |
| 9 | + * @version 4.0.6 | |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | defined( 'ABSPATH' ) || exit(); |
| 13 | 13 | |
| 14 | 14 | $checkout = LearnPress::instance()->checkout(); |
| 15 | +?> | |
| 16 | +<?php | |
| 17 | +if ( ! is_user_logged_in() ) { | |
| 18 | + $enable_login_on_page_checkout = LP_Settings::get_option( 'enable_login_checkout', 'yes' ) === 'yes'; | |
| 19 | + $login_text = sprintf( | |
| 20 | + '<a class="lp-link-login" href="%s">%s</a>', | |
| 21 | + learn_press_get_login_url( LP_Helper::getUrlCurrent() ), | |
| 22 | + __( 'login', 'learnpress' ) | |
| 23 | + ); | |
| 15 | 24 | |
| 16 | -learn_press_print_messages(); | |
| 17 | - | |
| 18 | -if ( ! is_user_logged_in() ) { | |
| 25 | + if ( $enable_login_on_page_checkout ) { | |
| 26 | + $login_text = __( 'login', 'learnpress' ); | |
| 27 | + } | |
| 19 | 28 | ?> |
| 20 | 29 | <div class="learn-press-message error"> |
| 21 | - <?php _e( 'Please log in to enroll in the course!', 'learnpress' ); ?> | |
| 30 | + <?php | |
| 31 | + printf( | |
| 32 | + __( 'Please %s in to enroll in the course!', 'learnpress' ), | |
| 33 | + $login_text | |
| 34 | + ); | |
| 35 | + ?> | |
| 22 | 36 | </div> |
| 23 | 37 | <?php |
| 24 | 38 | } |
| 39 | + | |
| 40 | +learn_press_show_message(); | |
| 25 | 41 | ?> |
| 26 | - | |
| 27 | - <form method="post" id="learn-press-checkout-form" name="learn-press-checkout-form" class="lp-checkout-form" tabindex="0" action="<?php echo esc_url_raw( learn_press_get_checkout_url() ); ?>" enctype="multipart/form-data"> | |
| 42 | + <form method="post" id="learn-press-checkout-form" name="learn-press-checkout-form" class="lp-checkout-form" | |
| 43 | + tabindex="0" action="<?php echo esc_url_raw( learn_press_get_checkout_url() ); ?>" | |
| 44 | + enctype="multipart/form-data"> | |
| 28 | 45 | <?php |
| 29 | 46 | if ( has_action( 'learn-press/before-checkout-form' ) ) { |
| 30 | 47 | ?> |
| 31 | 48 | <div class="lp-checkout-form__before"> |
| @@ -42,8 +59,9 @@ | ||
| 42 | 59 | <?php do_action( 'learn-press/after-checkout-form' ); ?> |
| 43 | 60 | </div> |
| 44 | 61 | <?php |
| 45 | 62 | } |
| 63 | + | |
| 64 | + wp_nonce_field( 'learn-press-checkout', 'learn-press-checkout-nonce', false ); | |
| 46 | 65 | ?> |
| 47 | 66 | </form> |
| 48 | - | |
| 49 | 67 | <?php |