Skip to content

Commit

Permalink
= 4.2.2.4 =
Browse files Browse the repository at this point in the history
~ Comment hook: "lp_add_shortcode_profile".
~ Add shortcode [learn_press_profile] to content page Profile if not exists.
  • Loading branch information
tungnxt89 committed Mar 28, 2023
1 parent 19505b9 commit b01f903
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 24 deletions.
6 changes: 5 additions & 1 deletion inc/class-lp-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,18 @@ public static function auto_shortcode( $template ) {
return $template;
}

if ( $post->ID == learn_press_get_page_id( 'checkout' ) ) {
if ( LP_Page_Controller::is_page_checkout() ) {
if ( ! preg_match( '/\[learn_press_checkout\s?(.*)\]/', $post->post_content ) ) {
$post->post_content .= '[learn_press_checkout]';
}
} elseif ( $post->ID == learn_press_get_page_id( 'become_a_teacher' ) ) {
if ( ! preg_match( '/\[learn_press_become_teacher_form\s?(.*)\]/', $post->post_content ) ) {
$post->post_content .= '[learn_press_become_teacher_form]';
}
} elseif ( LP_Page_Controller::is_page_profile() ) {
if ( ! preg_match( '/\[learn_press_profile\s?(.*)\]/', $post->post_content ) ) {
$post->post_content .= '[learn_press_profile]';
}
}

return $template;
Expand Down
5 changes: 4 additions & 1 deletion inc/lp-core-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3212,6 +3212,9 @@ function ( $plugin_data ) {
);

// If profile content don't have shortcode profile.
/**
* @deprecated 4.2.2.4
*/
function lp_add_shortcode_profile() {
global $post;

Expand All @@ -3223,7 +3226,7 @@ function lp_add_shortcode_profile() {
}
}

add_action( 'template_redirect', 'lp_add_shortcode_profile' );
//add_action( 'template_redirect', 'lp_add_shortcode_profile' );

/**
* If Elementor Pro set Theme builder type "Archive", will not show content on page "Archive course"
Expand Down
46 changes: 24 additions & 22 deletions templates/checkout/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @author ThimPress
* @package Learnpress/Templates
* @version 4.0.1
* @version 4.0.2
*/

defined( 'ABSPATH' ) || exit();
Expand All @@ -23,27 +23,29 @@
<?php
}
?>

<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">
<?php
if ( has_action( 'learn-press/before-checkout-form' ) ) {
?>
<div class="lp-checkout-form__before">
<?php do_action( 'learn-press/before-checkout-form' ); ?>
</div>
<div class="lp-content-area wp-block-group">
<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">
<?php
}

do_action( 'learn-press/checkout-form' );

if ( has_action( 'learn-press/after-checkout-form' ) ) {
if ( has_action( 'learn-press/before-checkout-form' ) ) {
?>
<div class="lp-checkout-form__before">
<?php do_action( 'learn-press/before-checkout-form' ); ?>
</div>
<?php
}

do_action( 'learn-press/checkout-form' );

if ( has_action( 'learn-press/after-checkout-form' ) ) {
?>
<div class="lp-checkout-form__after">
<?php do_action( 'learn-press/after-checkout-form' ); ?>
</div>
<?php
}
?>
<div class="lp-checkout-form__after">
<?php do_action( 'learn-press/after-checkout-form' ); ?>
</div>
<?php
}
?>
</form>

</form>
</div>
<?php

0 comments on commit b01f903

Please sign in to comment.