Version Description
- Fixed bug open lesson show nested popup window
- Fixed bug calculator wrong total raised
- Fixed external link for free course not working
- Update view of widget LearnPress status in dashboard page
Download this release
Release Info
Developer | leehld |
Plugin | LearnPress – WordPress LMS Plugin |
Version | 2.2.1 |
Comparing to | |
See all releases |
Code changes from version 2.2 to 2.2.1
- assets/js/frontend/single-course.js +15 -5
- inc/admin/dashboard-statistics/class-lp-statistic-status.php +1 -1
- inc/lp-constants.php +1 -1
- inc/lp-core-functions.php +7 -0
- inc/order/lp-order-functions.php +2 -2
- learnpress.php +1 -1
- readme.txt +7 -1
- templates/single-course/buttons.php +26 -28
assets/js/frontend/single-course.js
CHANGED
@@ -417,6 +417,14 @@ if (typeof LearnPress === 'undefined') {
|
|
417 |
},
|
418 |
_loadItem : function (e, f) {
|
419 |
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
420 |
var that = this,
|
421 |
$target = $(e.target),
|
422 |
id = this._getItemId($target);
|
@@ -436,14 +444,16 @@ if (typeof LearnPress === 'undefined') {
|
|
436 |
this.currentItem = this.model.getItem(id);
|
437 |
this.showPopup();
|
438 |
var $content = this.currentItem.get('content'),
|
439 |
-
isNew = !($content && $content.length);
|
440 |
-
|
|
|
|
|
441 |
$content = $('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen />');
|
442 |
this.currentItem.set('content', $content);
|
443 |
}
|
444 |
that.viewItem(id);
|
445 |
this.$('#popup-content-inner').html($content);
|
446 |
-
if (isNew) {
|
447 |
$content.attr('src', LP.addQueryVar('content-item-only', 'yes', this.currentItem.get('url')));
|
448 |
}
|
449 |
$content.unbind('load').load( function() {
|
@@ -462,9 +472,9 @@ if (typeof LearnPress === 'undefined') {
|
|
462 |
this.$('.course-item [data-id="' + item.get('id') + '"]').closest('.course-item').addClass('item-current');
|
463 |
this.$('#course-curriculum-popup').attr('data-item-id', item.get('id'));
|
464 |
this.updateUrl();
|
465 |
-
|
466 |
this.updateFooterNav();
|
467 |
-
if (item.get('type') === 'lp_quiz') {
|
468 |
this.loadQuiz();
|
469 |
}
|
470 |
return item;
|
417 |
},
|
418 |
_loadItem : function (e, f) {
|
419 |
e.preventDefault();
|
420 |
+
var isInIframe = (window.location != window.parent.location) ? true : false;
|
421 |
+
if(isInIframe){
|
422 |
+
var ihref = window.location.href;
|
423 |
+
if(ihref.match(/\?content-item-only=yes/gi)){
|
424 |
+
window.location.reload();
|
425 |
+
return;
|
426 |
+
}
|
427 |
+
}
|
428 |
var that = this,
|
429 |
$target = $(e.target),
|
430 |
id = this._getItemId($target);
|
444 |
this.currentItem = this.model.getItem(id);
|
445 |
this.showPopup();
|
446 |
var $content = this.currentItem.get('content'),
|
447 |
+
isNew = !( $content && $content.length );
|
448 |
+
var isInIframe = (window.location != window.parent.location) ? true : false;
|
449 |
+
console.log(isInIframe);
|
450 |
+
if ( !$content ) {
|
451 |
$content = $('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen />');
|
452 |
this.currentItem.set('content', $content);
|
453 |
}
|
454 |
that.viewItem(id);
|
455 |
this.$('#popup-content-inner').html($content);
|
456 |
+
if ( isNew ) {
|
457 |
$content.attr('src', LP.addQueryVar('content-item-only', 'yes', this.currentItem.get('url')));
|
458 |
}
|
459 |
$content.unbind('load').load( function() {
|
472 |
this.$('.course-item [data-id="' + item.get('id') + '"]').closest('.course-item').addClass('item-current');
|
473 |
this.$('#course-curriculum-popup').attr('data-item-id', item.get('id'));
|
474 |
this.updateUrl();
|
475 |
+
this.updateItemContent(item);
|
476 |
this.updateFooterNav();
|
477 |
+
if ( item.get( 'type' ) === 'lp_quiz' ) {
|
478 |
this.loadQuiz();
|
479 |
}
|
480 |
return item;
|
inc/admin/dashboard-statistics/class-lp-statistic-status.php
CHANGED
@@ -24,7 +24,7 @@ if ( !class_exists( 'LP_Statistic_Status' ) ) :
|
|
24 |
?>
|
25 |
<ul class="learnpress-statistic-status">
|
26 |
<li class="full-width">
|
27 |
-
<a href="
|
28 |
<span>
|
29 |
<?php echo _learn_press_total_raised() ?>
|
30 |
<?php _e( 'Total Raised', 'learnpress' ); ?>
|
24 |
?>
|
25 |
<ul class="learnpress-statistic-status">
|
26 |
<li class="full-width">
|
27 |
+
<a href="<?php echo esc_url( admin_url( 'admin.php?page=learn-press-statistics') )?>" class="total-raised">
|
28 |
<span>
|
29 |
<?php echo _learn_press_total_raised() ?>
|
30 |
<?php _e( 'Total Raised', 'learnpress' ); ?>
|
inc/lp-constants.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*/
|
5 |
$upload_dir = wp_upload_dir();
|
6 |
// version
|
7 |
-
define( 'LEARNPRESS_VERSION', '2.2' );
|
8 |
|
9 |
define( 'LP_WP_CONTENT', basename( WP_CONTENT_DIR ) );
|
10 |
|
4 |
*/
|
5 |
$upload_dir = wp_upload_dir();
|
6 |
// version
|
7 |
+
define( 'LEARNPRESS_VERSION', '2.2.1' );
|
8 |
|
9 |
define( 'LP_WP_CONTENT', basename( WP_CONTENT_DIR ) );
|
10 |
|
inc/lp-core-functions.php
CHANGED
@@ -1611,6 +1611,13 @@ add_filter( 'pre_get_posts', 'learn_press_filter_search', 99 );
|
|
1611 |
*/
|
1612 |
function learn_press_send_json( $data ) {
|
1613 |
echo '<-- LP_AJAX_START -->';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1614 |
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
1615 |
echo wp_json_encode( $data );
|
1616 |
echo '<-- LP_AJAX_END -->';
|
1611 |
*/
|
1612 |
function learn_press_send_json( $data ) {
|
1613 |
echo '<-- LP_AJAX_START -->';
|
1614 |
+
/**
|
1615 |
+
* fixed bug: can't buy course with PayPal
|
1616 |
+
*/
|
1617 |
+
@header('HTTP/1.0 200 OK');
|
1618 |
+
/**
|
1619 |
+
* end
|
1620 |
+
**/
|
1621 |
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
1622 |
echo wp_json_encode( $data );
|
1623 |
echo '<-- LP_AJAX_END -->';
|
inc/order/lp-order-functions.php
CHANGED
@@ -865,12 +865,12 @@ function _learn_press_checkout_auto_enroll_free_course( $result, $order_id ) {
|
|
865 |
|
866 |
if ( !function_exists( '_learn_press_total_raised' ) ) {
|
867 |
function _learn_press_total_raised() {
|
868 |
-
|
869 |
$total = 0;
|
870 |
if ( $orders ) {
|
871 |
foreach ( $orders as $order ) {
|
872 |
$order = learn_press_get_order( $order->ID );
|
873 |
-
$total = $total + $order->order_total;
|
874 |
}
|
875 |
}
|
876 |
|
865 |
|
866 |
if ( !function_exists( '_learn_press_total_raised' ) ) {
|
867 |
function _learn_press_total_raised() {
|
868 |
+
$orders = learn_press_get_orders( array( 'post_status' => 'lp-completed', 'posts_per_page' => 1000 ) );
|
869 |
$total = 0;
|
870 |
if ( $orders ) {
|
871 |
foreach ( $orders as $order ) {
|
872 |
$order = learn_press_get_order( $order->ID );
|
873 |
+
$total = $total + floatval( $order->order_total );
|
874 |
}
|
875 |
}
|
876 |
|
learnpress.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: LearnPress
|
|
4 |
Plugin URI: http://thimpress.com/learnpress
|
5 |
Description: LearnPress is a WordPress complete solution for creating a Learning Management System (LMS). It can help you to create courses, lessons and quizzes.
|
6 |
Author: ThimPress
|
7 |
-
Version: 2.2
|
8 |
Author URI: http://thimpress.com
|
9 |
Requires at least: 3.8
|
10 |
Tested up to: 4.9.4
|
4 |
Plugin URI: http://thimpress.com/learnpress
|
5 |
Description: LearnPress is a WordPress complete solution for creating a Learning Management System (LMS). It can help you to create courses, lessons and quizzes.
|
6 |
Author: ThimPress
|
7 |
+
Version: 2.2.1
|
8 |
Author URI: http://thimpress.com
|
9 |
Requires at least: 3.8
|
10 |
Tested up to: 4.9.4
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:
|
|
4 |
Tags: WordPress LMS, LMS, eLearning, e-Learning, Learning Management System, LMS WordPress, Course, Courses, Quiz, Quizzes, Training, Guru, Sell Courses
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.9.4
|
7 |
-
Stable tag: 2.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -199,6 +199,12 @@ https://www.transifex.com/projects/p/learnpress/
|
|
199 |
|
200 |
== Changelog ==
|
201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
= 2.2 =
|
203 |
+ Compatible with WordPress 4.9.4
|
204 |
+ Fixed "Finish Course" button not show in can retake course
|
4 |
Tags: WordPress LMS, LMS, eLearning, e-Learning, Learning Management System, LMS WordPress, Course, Courses, Quiz, Quizzes, Training, Guru, Sell Courses
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.9.4
|
7 |
+
Stable tag: 2.2.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
199 |
|
200 |
== Changelog ==
|
201 |
|
202 |
+
= 2.2.1 =
|
203 |
+
+ Fixed bug open lesson show nested popup window
|
204 |
+
+ Fixed bug calculator wrong total raised
|
205 |
+
+ Fixed external link for free course not working
|
206 |
+
+ Update view of widget LearnPress status in dashboard page
|
207 |
+
|
208 |
= 2.2 =
|
209 |
+ Compatible with WordPress 4.9.4
|
210 |
+ Fixed "Finish Course" button not show in can retake course
|
templates/single-course/buttons.php
CHANGED
@@ -30,16 +30,15 @@ $notice_enough_student = apply_filters( 'learn_press_course enough students_noti
|
|
30 |
$course_status = $lp_user->get_course_status( $course->id );
|
31 |
$can_purchase = $lp_user->can_purchase_course( $course->id );
|
32 |
$can_enroll = $lp_user->can( 'enroll-course', $course->id );
|
33 |
-
|
34 |
if ( $can_purchase ) {
|
35 |
# todo dispay purchase button
|
36 |
if ( $external_link = $course->get_external_link() ) {
|
37 |
-
|
38 |
$external_button_text = apply_filters( 'learn_press_course_external_link_button_text', __( 'Buy this course', 'learnpress' ) ); ?>
|
39 |
|
40 |
<?php do_action( 'learn_press_before_external_link_buy_course' ); ?>
|
41 |
<div class="purchase-course">
|
42 |
-
<a href="<?php echo esc_url( $external_link ); ?>" class="purchase-button">
|
43 |
<?php echo $external_button_text; ?>
|
44 |
</a>
|
45 |
</div>
|
@@ -109,32 +108,31 @@ $notice_enough_student = apply_filters( 'learn_press_course enough students_noti
|
|
109 |
</button>
|
110 |
<?php
|
111 |
|
112 |
-
elseif ( $user->can( 'enroll-course', $course->id ) === true ) :
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
</form>
|
136 |
-
|
137 |
<?php
|
|
|
138 |
|
139 |
|
140 |
elseif ( $course->is_reached_limit()/* $user->can( 'enroll-course', $course->id ) === 'enough'*/ ) : ?>
|
30 |
$course_status = $lp_user->get_course_status( $course->id );
|
31 |
$can_purchase = $lp_user->can_purchase_course( $course->id );
|
32 |
$can_enroll = $lp_user->can( 'enroll-course', $course->id );
|
|
|
33 |
if ( $can_purchase ) {
|
34 |
# todo dispay purchase button
|
35 |
if ( $external_link = $course->get_external_link() ) {
|
36 |
+
|
37 |
$external_button_text = apply_filters( 'learn_press_course_external_link_button_text', __( 'Buy this course', 'learnpress' ) ); ?>
|
38 |
|
39 |
<?php do_action( 'learn_press_before_external_link_buy_course' ); ?>
|
40 |
<div class="purchase-course">
|
41 |
+
<a href="<?php echo esc_url( $external_link ); ?>" class="button purchase-button">
|
42 |
<?php echo $external_button_text; ?>
|
43 |
</a>
|
44 |
</div>
|
108 |
</button>
|
109 |
<?php
|
110 |
|
111 |
+
elseif ( $user->can( 'enroll-course', $course->id ) === true ) :
|
112 |
+
if ( !$user->has('purchased-course', $course->id ) && ($external_link = $course->get_external_link()) ) {
|
113 |
+
$external_button_text = apply_filters( 'learn_press_enroll_course_external_link_button_text', __( 'Buy this course', 'learnpress' ) ); ?>
|
114 |
+
<?php do_action( 'learn_press_before_external_link_buy_course' ); ?>
|
115 |
+
<div class="purchase-course">
|
116 |
+
<a href="<?php echo esc_url( $external_link ); ?>" class="button purchase-button">
|
117 |
+
<?php echo $external_button_text; ?>
|
118 |
+
</a>
|
119 |
+
</div>
|
120 |
+
<?php do_action( 'learn_press_after_external_link_buy_course' ); ?>
|
121 |
+
<?php
|
122 |
+
} else {
|
123 |
+
?>
|
124 |
+
<form name="enroll-course" class="enroll-course" method="post" enctype="multipart/form-data">
|
125 |
+
<?php do_action( 'learn_press_before_enroll_button' ); ?>
|
126 |
+
|
127 |
+
<input type="hidden" name="lp-ajax" value="enroll-course"/>
|
128 |
+
<input type="hidden" name="enroll-course" value="<?php echo $course->id; ?>"/>
|
129 |
+
<button class="button enroll-button"
|
130 |
+
data-block-content="yes"><?php echo $enroll_button_text; ?></button>
|
131 |
+
|
132 |
+
<?php do_action( 'learn_press_after_enroll_button' ); ?>
|
133 |
+
</form>
|
|
|
|
|
134 |
<?php
|
135 |
+
}
|
136 |
|
137 |
|
138 |
elseif ( $course->is_reached_limit()/* $user->can( 'enroll-course', $course->id ) === 'enough'*/ ) : ?>
|