LearnPress – WordPress LMS Plugin - Version 3.0.3

Version Description

~ Fixed quiz auto finish with duration is zero ~ Fixed pagination with quizzes in user profile ~ Fixed warning notice when getting current tab in profile ~ Fixed some issue in addons

Download this release

Release Info

Developer tunnhn
Plugin Icon 128x128 LearnPress – WordPress LMS Plugin
Version 3.0.3
Comparing to
See all releases

Code changes from version 3.0.2 to 3.0.3

assets/css/learnpress.css CHANGED
@@ -1278,7 +1278,10 @@ body .lp-quiz-buttons .form-button-finish-course {
1278
margin-bottom: 20px; } }
1279
1280
.lp-quiz-buttons {
1281
- margin-bottom: 20px; }
1282
1283
.quiz-progress {
1284
background: #e7f7ff;
1278
margin-bottom: 20px; } }
1279
1280
.lp-quiz-buttons {
1281
+ margin-bottom: 20px;
1282
+ clear: both;
1283
+ display: block;
1284
+ content: ''; }
1285
1286
.quiz-progress {
1287
background: #e7f7ff;
assets/js/frontend/quiz.js CHANGED
@@ -119,8 +119,10 @@
119
this.on = callbackEvents.on;
120
this.off = callbackEvents.off;
121
122
- this.on('tick.showTime', showTime);
123
- this.on('finish.submit', submit);
124
125
this.getRemainingTime = function () {
126
return remainingTime;
119
this.on = callbackEvents.on;
120
this.off = callbackEvents.off;
121
122
+ if(thisSettings.totalTime > 0) {
123
+ this.on('tick.showTime', showTime);
124
+ this.on('finish.submit', submit);
125
+ }
126
127
this.getRemainingTime = function () {
128
return remainingTime;
assets/scss/frontend/_quiz.scss CHANGED
@@ -1,5 +1,6 @@
1
.lp-quiz-buttons {
2
margin-bottom: 20px;
3
}
4
5
.quiz-progress {
1
.lp-quiz-buttons {
2
margin-bottom: 20px;
3
+ @include clear-fix();
4
}
5
6
.quiz-progress {
inc/abstracts/abstract-array-access.php CHANGED
@@ -3,7 +3,7 @@
3
/**
4
* Class LP_Array_Access
5
*/
6
- class LP_Array_Access implements ArrayAccess, Iterator {
7
8
/**
9
* @var array
@@ -92,4 +92,8 @@ class LP_Array_Access implements ArrayAccess, Iterator {
92
93
return isset( $values[ $this->_position ] );
94
}
95
}
3
/**
4
* Class LP_Array_Access
5
*/
6
+ class LP_Array_Access implements ArrayAccess, Iterator, Countable {
7
8
/**
9
* @var array
92
93
return isset( $values[ $this->_position ] );
94
}
95
+
96
+ public function count() {
97
+ return sizeof($this->_data);
98
+ }
99
}
inc/class-lp-breadcrumb.php CHANGED
@@ -59,9 +59,6 @@ class LP_Breadcrumb {
59
*/
60
public function generate() {
61
$conditionals = array(
62
- 'is_home',
63
- 'is_404',
64
- 'is_attachment',
65
'is_single',
66
'learn_press_is_course_category',
67
'learn_press_is_course_tag',
@@ -72,11 +69,15 @@ class LP_Breadcrumb {
72
'is_tag',
73
'is_author',
74
'is_date',
75
- 'is_tax'
76
);
77
78
if ( ( ! is_front_page() && ! ( is_post_type_archive() && get_option( 'page_on_front' ) == learn_press_get_page_id( 'courses' ) ) ) || is_paged() ) {
79
foreach ( $conditionals as $conditional ) {
80
if ( is_callable( $conditional ) && call_user_func( $conditional ) ) {
81
$conditional = preg_replace( '/^learn_press_/', '', $conditional );
82
$conditional = preg_replace( '/^is_/', '', $conditional );
59
*/
60
public function generate() {
61
$conditionals = array(
62
'is_single',
63
'learn_press_is_course_category',
64
'learn_press_is_course_tag',
69
'is_tag',
70
'is_author',
71
'is_date',
72
+ 'is_tax',
73
+ 'is_home',
74
+ 'is_404',
75
+ 'is_attachment',
76
);
77
78
if ( ( ! is_front_page() && ! ( is_post_type_archive() && get_option( 'page_on_front' ) == learn_press_get_page_id( 'courses' ) ) ) || is_paged() ) {
79
foreach ( $conditionals as $conditional ) {
80
+
81
if ( is_callable( $conditional ) && call_user_func( $conditional ) ) {
82
$conditional = preg_replace( '/^learn_press_/', '', $conditional );
83
$conditional = preg_replace( '/^is_/', '', $conditional );
inc/class-lp-install.php CHANGED
@@ -105,7 +105,7 @@ if ( ! function_exists( 'LP_Install' ) ) {
105
$db_version = get_option( 'learnpress_db_version' );
106
107
// Check latest version with the value updated in db
108
- if ( version_compare( $db_version, LEARNPRESS_VERSION, '=' ) ) {
109
return;
110
}
111
105
$db_version = get_option( 'learnpress_db_version' );
106
107
// Check latest version with the value updated in db
108
+ if ( !$db_version || version_compare( $db_version, LEARNPRESS_VERSION, '=' ) ) {
109
return;
110
}
111
inc/lp-constants.php CHANGED
@@ -4,7 +4,7 @@
4
*/
5
$upload_dir = wp_upload_dir();
6
// version
7
- define( 'LEARNPRESS_VERSION', '3.0.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', '3.0.3' );
8
9
define( 'LP_WP_CONTENT', basename( WP_CONTENT_DIR ) );
10
inc/lp-core-functions.php CHANGED
@@ -2254,6 +2254,12 @@ function learn_press_get_current_profile_tab( $default = true ) {
2254
$current = $wp->query_vars['view'];
2255
} else {
2256
if ( $default && $tabs = learn_press_get_user_profile_tabs() ) {
2257
$tab_keys = array_keys( $tabs );
2258
$current = reset( $tab_keys );
2259
}
@@ -2262,6 +2268,11 @@ function learn_press_get_current_profile_tab( $default = true ) {
2262
return $current;
2263
}
2264
2265
function learn_press_profile_tab_exists( $tab ) {
2266
if ( $tabs = learn_press_get_user_profile_tabs() ) {
2267
return ! empty( $tabs[ $tab ] ) ? true : false;
2254
$current = $wp->query_vars['view'];
2255
} else {
2256
if ( $default && $tabs = learn_press_get_user_profile_tabs() ) {
2257
+
2258
+ // Fixed for array_keys does not work with ArrayAccess instance
2259
+ if ( $tabs instanceof LP_Profile_Tabs ) {
2260
+ $tabs = $tabs->tabs();
2261
+ }
2262
+
2263
$tab_keys = array_keys( $tabs );
2264
$current = reset( $tab_keys );
2265
}
2268
return $current;
2269
}
2270
2271
+ add_action( 'init', function () {
2272
+ learn_press_get_current_profile_tab();
2273
+
2274
+
2275
+ } );
2276
function learn_press_profile_tab_exists( $tab ) {
2277
if ( $tabs = learn_press_get_user_profile_tabs() ) {
2278
return ! empty( $tabs[ $tab ] ) ? true : false;
inc/order/class-lp-order.php CHANGED
@@ -147,19 +147,19 @@ if ( ! class_exists( 'LP_Order' ) ) {
147
148
switch ( $format ) {
149
case 'd':
150
- $return = date( 'Y-m-d', $strtime );
151
break;
152
case 'h':
153
- $return = date( 'H', $strtime );
154
break;
155
case 'm':
156
- $return = date( 'i', $strtime );
157
break;
158
case 'timestamp':
159
$return = $strtime;
160
break;
161
default:
162
- $return = $format ? date( $format, $strtime ) : $date;
163
}
164
165
return $return;
147
148
switch ( $format ) {
149
case 'd':
150
+ $return = date_i18n( 'Y-m-d', $strtime );
151
break;
152
case 'h':
153
+ $return = date_i18n( 'H', $strtime );
154
break;
155
case 'm':
156
+ $return = date_i18n( 'i', $strtime );
157
break;
158
case 'timestamp':
159
$return = $strtime;
160
break;
161
default:
162
+ $return = $format ? date_i18n( $format, $strtime ) : $date;
163
}
164
165
return $return;
inc/user/abstract-lp-user.php CHANGED
@@ -431,6 +431,7 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
431
* @return mixed
432
*/
433
public function finish_quiz( $quiz_id, $course_id, $wp_error = false ) {
434
if ( ! apply_filters( 'learn_press_before_user_finish_quiz', true, $quiz_id, $course_id, $this->get_id() ) ) {
435
return false;
436
}
@@ -1862,7 +1863,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1862
if ( $return ) {
1863
do_action( 'learn-press/user-course-finished', $course_id, $this->get_id(), $return );
1864
}
1865
-
1866
wp_cache_flush();
1867
}
1868
}
431
* @return mixed
432
*/
433
public function finish_quiz( $quiz_id, $course_id, $wp_error = false ) {
434
+
435
if ( ! apply_filters( 'learn_press_before_user_finish_quiz', true, $quiz_id, $course_id, $this->get_id() ) ) {
436
return false;
437
}
1863
if ( $return ) {
1864
do_action( 'learn-press/user-course-finished', $course_id, $this->get_id(), $return );
1865
}
1866
wp_cache_flush();
1867
}
1868
}
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: 3.0.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: 3.0.3
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: 3.0.2
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -198,6 +198,13 @@ https://www.transifex.com/projects/p/learnpress/
198
8. Add-ons of LearnPress.
199
200
== Changelog ==
201
= 3.0.2 =
202
~ Fixed PHP non-numeric cast type
203
~ Improved admin ajax for course/quiz/question editor
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: 3.0.3
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
198
8. Add-ons of LearnPress.
199
200
== Changelog ==
201
+ = 3.0.3 =
202
+ ~ Fixed quiz auto finish with duration is zero
203
+ ~ Fixed pagination with quizzes in user profile
204
+ ~ Fixed warning notice when getting current tab in profile
205
+ ~ Fixed some issue in addons
206
+
207
+
208
= 3.0.2 =
209
~ Fixed PHP non-numeric cast type
210
~ Improved admin ajax for course/quiz/question editor
templates/profile/tabs/quizzes.php CHANGED
@@ -56,7 +56,10 @@ $query = $profile->query_quizzes( array( 'status' => $filter_status ) );
56
} ?>
57
58
</td>
59
- <td class="column-date"><?php echo $user_quiz->get_start_time( 'd M Y' ); ?></td>
60
<td class="column-status">
61
<span class="result-percent"><?php echo $user_quiz->get_percent_result(); ?></span>
62
<span class="lp-label label-<?php echo esc_attr( $user_quiz->get_results( 'status' ) ); ?>">
56
} ?>
57
58
</td>
59
+ <td class="column-date"><?php
60
+ // echo $user_quiz->get_start_time( 'd M Y' );
61
+ $start_time = $user_quiz->get_start_time();
62
+ echo date_i18n( get_option( 'date_format' ), $start_time->getTimestamp() ); ?></td>
63
<td class="column-status">
64
<span class="result-percent"><?php echo $user_quiz->get_percent_result(); ?></span>
65
<span class="lp-label label-<?php echo esc_attr( $user_quiz->get_results( 'status' ) ); ?>">