| 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 |
| 68 |
|