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