LearnPress – WordPress LMS Plugin - Version 3.2.5.6

Version Description

~ Added new strings for translating. ~ Corrected currency of Rwandan franc. ~ Fixed missing utils library when adding manually the orders. ~ Fixed upgrade function that doesn't hide the message when it done. ~ Fixed can't create new page in settings.

Download this release

Release Info

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

Code changes from version 3.2.5.5 to 3.2.5.6

inc/admin/class-lp-admin-assets.php CHANGED
@@ -71,33 +71,33 @@ class LP_Admin_Assets extends LP_Abstract_Assets {
71
  )
72
  ),
73
  'lp-vuex' => array(
74
- 'url' => self::url( 'js/vendor/vuex.js' ),
75
- 'ver' => '3.1.0',
76
- 'deps' => array( 'lp-vue' ),
77
  'screens' => array(
78
  'learnpress'
79
  )
80
  ),
81
  'lp-vue-resource' => array(
82
- 'url' => self::url( 'js/vendor/vue-resource.js' ),
83
- 'ver' => '1.3.4',
84
- 'deps' => array( 'lp-vue' ),
85
  'screens' => array(
86
  'learnpress'
87
  )
88
  ),
89
  'lp-sortable' => array(
90
- 'url' => self::url( 'js/vendor/sortable.js' ),
91
- 'ver' => '1.6.0',
92
- 'deps' => array( 'lp-vue' ),
93
  'screens' => array(
94
  'learnpress'
95
  )
96
  ),
97
  'lp-vuedraggable' => array(
98
- 'url' => self::url( 'js/vendor/vuedraggable.js' ),
99
- 'ver' => '2.14.1',
100
- 'deps' => array( 'lp-vue', 'lp-sortable' ),
101
  'screens' => array(
102
  'learnpress'
103
  )
@@ -117,17 +117,19 @@ class LP_Admin_Assets extends LP_Abstract_Assets {
117
  'url' => $this->url( 'js/admin/utils.js' ),
118
  'deps' => array( 'jquery' )
119
  ),
120
- 'admin' => array(
121
- 'url' => $this->url( 'js/admin/admin.js' ),
122
- 'deps' => array( 'learn-press-global', 'learn-press-utils', 'wp-color-picker' )
123
- ),
 
124
  'admin-tabs' => array(
125
  'url' => $this->url( 'js/admin/admin-tabs.js' ),
126
  'deps' => array( 'jquery' )
127
  ),
128
  'lp-admin' => array(
129
  'url' => $this->url( 'js/admin/admin.js' ),
130
- 'deps' => array( 'learn-press-global', 'learn-press-utils', 'wp-color-picker' )
 
131
  ),
132
  'lp-admin-tabs' => array(
133
  'url' => $this->url( 'js/admin/admin-tabs.js' ),
@@ -175,6 +177,7 @@ class LP_Admin_Assets extends LP_Abstract_Assets {
175
  'deps' => array(
176
  'learn-press-modal-search-items',
177
  'learn-press-modal-search-users',
 
178
  'lp-vue'
179
  ),
180
  'screens' => array( LP_ORDER_CPT )
71
  )
72
  ),
73
  'lp-vuex' => array(
74
+ 'url' => self::url( 'js/vendor/vuex.js' ),
75
+ 'ver' => '3.1.0',
76
+ 'deps' => array( 'lp-vue' ),
77
  'screens' => array(
78
  'learnpress'
79
  )
80
  ),
81
  'lp-vue-resource' => array(
82
+ 'url' => self::url( 'js/vendor/vue-resource.js' ),
83
+ 'ver' => '1.3.4',
84
+ 'deps' => array( 'lp-vue' ),
85
  'screens' => array(
86
  'learnpress'
87
  )
88
  ),
89
  'lp-sortable' => array(
90
+ 'url' => self::url( 'js/vendor/sortable.js' ),
91
+ 'ver' => '1.6.0',
92
+ 'deps' => array( 'lp-vue' ),
93
  'screens' => array(
94
  'learnpress'
95
  )
96
  ),
97
  'lp-vuedraggable' => array(
98
+ 'url' => self::url( 'js/vendor/vuedraggable.js' ),
99
+ 'ver' => '2.14.1',
100
+ 'deps' => array( 'lp-vue', 'lp-sortable' ),
101
  'screens' => array(
102
  'learnpress'
103
  )
117
  'url' => $this->url( 'js/admin/utils.js' ),
118
  'deps' => array( 'jquery' )
119
  ),
120
+ // 'admin' => array(
121
+ // 'url' => $this->url( 'js/admin/admin.js' ),
122
+ // 'deps' => array( 'learn-press-global', 'learn-press-utils', 'wp-color-picker' ),
123
+ // 'screens' => array( 'learnpress' )
124
+ // ),
125
  'admin-tabs' => array(
126
  'url' => $this->url( 'js/admin/admin-tabs.js' ),
127
  'deps' => array( 'jquery' )
128
  ),
129
  'lp-admin' => array(
130
  'url' => $this->url( 'js/admin/admin.js' ),
131
+ 'deps' => array( 'learn-press-global', 'learn-press-utils', 'wp-color-picker' ),
132
+ 'screens' => array( 'learnpress' )
133
  ),
134
  'lp-admin-tabs' => array(
135
  'url' => $this->url( 'js/admin/admin-tabs.js' ),
177
  'deps' => array(
178
  'learn-press-modal-search-items',
179
  'learn-press-modal-search-users',
180
+ 'learn-press-utils',
181
  'lp-vue'
182
  ),
183
  'screens' => array( LP_ORDER_CPT )
inc/admin/class-lp-admin.php CHANGED
@@ -485,7 +485,7 @@ if ( ! class_exists( 'LP_Admin' ) ) {
485
  'denied-request'
486
  ) ) ) && ( $user_id = LP_Request::get_int( 'user_id' ) ) && get_user_by( 'id', $user_id ) ) {
487
  if ( ! current_user_can( 'promote_user', $user_id ) ) {
488
- wp_die( __( 'Sorry, you are not allowed to edit this user.' ) );
489
  } ?>
490
 
491
  <div class="updated notice">
485
  'denied-request'
486
  ) ) ) && ( $user_id = LP_Request::get_int( 'user_id' ) ) && get_user_by( 'id', $user_id ) ) {
487
  if ( ! current_user_can( 'promote_user', $user_id ) ) {
488
+ wp_die( __( 'Sorry, you are not allowed to edit this user.', 'learnpress' ) );
489
  } ?>
490
 
491
  <div class="updated notice">
inc/admin/helpers/class-lp-plugins-helper.php CHANGED
@@ -235,23 +235,23 @@ class LP_Plugins_Helper {
235
  case 'install':
236
  if ( $status['url'] ) {
237
  /* translators: 1: Plugin name and version. */
238
- $action_links[] = '<a class="install-now button" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Install %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '" data-success="Installed"><span>' . __( 'Install Now' ) . '</span></a>';
239
  }
240
 
241
  break;
242
  case 'update_available':
243
  if ( $status['url'] ) {
244
  /* translators: 1: Plugin name and version */
245
- $action_links[] = '<a class="update-now button" data-plugin="' . esc_attr( $status['file'] ) . '" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Update %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '"><span>' . __( 'Update Now' ) . '</span></a>';
246
  }
247
 
248
  break;
249
  }
250
  if ( learn_press_is_plugin_install( $file ) ) {
251
  if ( is_plugin_active( $file ) ) {
252
- $action_links[] = '<a class="button disable-now" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $file, 'deactivate-plugin_' . $file ) ) . '" aria-label="' . esc_attr( sprintf( __( 'Disable %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '"><span>' . __( 'Disable Now', 'learnpress' ) . '</span></a>';
253
  } else {
254
- $action_links[] = '<a class="button enable-now" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( wp_nonce_url( 'plugins.php?action=activate&plugin=' . $file, 'activate-plugin_' . $file ) ) . '" aria-label="' . esc_attr( sprintf( __( 'Enable %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '"><span>' . __( 'Enable Now', 'learnpress' ) . '</span></a>';
255
  }
256
  }
257
 
@@ -259,14 +259,14 @@ class LP_Plugins_Helper {
259
  // action links for premium add-ons installed
260
  if ( learn_press_is_plugin_install( $file ) ) {
261
  if ( is_plugin_active( $file ) ) {
262
- $action_links[] = '<a class="button disable-now" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $file, 'deactivate-plugin_' . $file ) ) . '" aria-label="' . esc_attr( sprintf( __( 'Disable %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '"><span>' . __( 'Disable Now', 'learnpress' ) . '</span></a>';
263
  } else {
264
- $action_links[] = '<a class="button enable-now" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( wp_nonce_url( 'plugins.php?action=activate&plugin=' . $file, 'activate-plugin_' . $file ) ) . '" aria-label="' . esc_attr( sprintf( __( 'Enable %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '"><span>' . __( 'Enable Now', 'learnpress' ) . '</span></a>';
265
  }
266
  } else {
267
  // buy now button for premium add-ons
268
  if ( isset( $plugin['permarklink'] ) ) {
269
- $action_links[] = '<a class="buy-now button" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( $plugin['permarklink'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Buy %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Buy Now' ) . '</a>';
270
  }
271
  }
272
  }
235
  case 'install':
236
  if ( $status['url'] ) {
237
  /* translators: 1: Plugin name and version. */
238
+ $action_links[] = '<a class="install-now button" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Install %s now', 'learnpress' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '" data-success="Installed"><span>' . __( 'Install Now' ) . '</span></a>';
239
  }
240
 
241
  break;
242
  case 'update_available':
243
  if ( $status['url'] ) {
244
  /* translators: 1: Plugin name and version */
245
+ $action_links[] = '<a class="update-now button" data-plugin="' . esc_attr( $status['file'] ) . '" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Update %s now', 'learnpress' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '"><span>' . __( 'Update Now' ) . '</span></a>';
246
  }
247
 
248
  break;
249
  }
250
  if ( learn_press_is_plugin_install( $file ) ) {
251
  if ( is_plugin_active( $file ) ) {
252
+ $action_links[] = '<a class="button disable-now" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $file, 'deactivate-plugin_' . $file ) ) . '" aria-label="' . esc_attr( sprintf( __( 'Disable %s now', 'learnpress' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '"><span>' . __( 'Disable Now', 'learnpress' ) . '</span></a>';
253
  } else {
254
+ $action_links[] = '<a class="button enable-now" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( wp_nonce_url( 'plugins.php?action=activate&plugin=' . $file, 'activate-plugin_' . $file ) ) . '" aria-label="' . esc_attr( sprintf( __( 'Enable %s now', 'learnpress' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '"><span>' . __( 'Enable Now', 'learnpress' ) . '</span></a>';
255
  }
256
  }
257
 
259
  // action links for premium add-ons installed
260
  if ( learn_press_is_plugin_install( $file ) ) {
261
  if ( is_plugin_active( $file ) ) {
262
+ $action_links[] = '<a class="button disable-now" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $file, 'deactivate-plugin_' . $file ) ) . '" aria-label="' . esc_attr( sprintf( __( 'Disable %s now', 'learnpress' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '"><span>' . __( 'Disable Now', 'learnpress' ) . '</span></a>';
263
  } else {
264
+ $action_links[] = '<a class="button enable-now" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( wp_nonce_url( 'plugins.php?action=activate&plugin=' . $file, 'activate-plugin_' . $file ) ) . '" aria-label="' . esc_attr( sprintf( __( 'Enable %s now', 'learnpress' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '"><span>' . __( 'Enable Now', 'learnpress' ) . '</span></a>';
265
  }
266
  } else {
267
  // buy now button for premium add-ons
268
  if ( isset( $plugin['permarklink'] ) ) {
269
+ $action_links[] = '<a class="buy-now button" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( $plugin['permarklink'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Buy %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Buy Now', 'learnpress' ) . '</a>';
270
  }
271
  }
272
  }
inc/admin/sub-menus/class-lp-submenu-settings.php CHANGED
@@ -60,7 +60,7 @@ class LP_Submenu_Settings extends LP_Abstract_Submenu {
60
  break;
61
  case 'emails':
62
  $sections = array(
63
- 'new_course' => __( 'New course' )
64
  );
65
  $this->sections = apply_filters( 'learn-press/admin/page-settings/emails/sections', $sections );
66
  break;
60
  break;
61
  case 'emails':
62
  $sections = array(
63
+ 'new_course' => __( 'New course', 'learnpress' )
64
  );
65
  $this->sections = apply_filters( 'learn-press/admin/page-settings/emails/sections', $sections );
66
  break;
inc/admin/views/meta-boxes/order/actions.php CHANGED
@@ -26,9 +26,9 @@ defined( 'ABSPATH' ) || exit();
26
  <?php
27
  if ( current_user_can( "delete_post", $post->ID ) ) {
28
  if ( ! EMPTY_TRASH_DAYS ) {
29
- $delete_text = __( 'Delete Permanently' );
30
  } else {
31
- $delete_text = __( 'Move to Trash' );
32
  } ?>
33
  <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>">
34
  <?php echo $delete_text; ?>
26
  <?php
27
  if ( current_user_can( "delete_post", $post->ID ) ) {
28
  if ( ! EMPTY_TRASH_DAYS ) {
29
+ $delete_text = __( 'Delete Permanently', 'learnpress' );
30
  } else {
31
+ $delete_text = __( 'Move to Trash', 'learnpress' );
32
  } ?>
33
  <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>">
34
  <?php echo $delete_text; ?>
inc/admin/views/updates/html-updating-message.php CHANGED
@@ -19,6 +19,20 @@ defined( 'ABSPATH' ) or die();
19
  (function (win, doc) {
20
  var t = null;
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  function sendRequest() {
23
  t = setTimeout(function () {
24
  var $ = jQuery;
@@ -28,7 +42,7 @@ defined( 'ABSPATH' ) or die();
28
  'lp-ajax': 'check-updated'
29
  },
30
  success: function (response) {
31
- response = LP.parseJSON(response);
32
  if (response.result === 'success') {
33
  clearInterval(t);
34
  $('.lp-notice-update-database.do-updating').replaceWith($(response.message));
19
  (function (win, doc) {
20
  var t = null;
21
 
22
+ function parseJSON(data) {
23
+ var m = (data + '').match(/<-- LP_AJAX_START -->(.*)<-- LP_AJAX_END -->/);
24
+ try {
25
+ if (m) {
26
+ data = $.parseJSON(m[1]);
27
+ } else {
28
+ data = $.parseJSON(data);
29
+ }
30
+ } catch (e) {
31
+ data = {};
32
+ }
33
+ return data;
34
+ }
35
+
36
  function sendRequest() {
37
  t = setTimeout(function () {
38
  var $ = jQuery;
42
  'lp-ajax': 'check-updated'
43
  },
44
  success: function (response) {
45
+ response = parseJSON(response);
46
  if (response.result === 'success') {
47
  clearInterval(t);
48
  $('.lp-notice-update-database.do-updating').replaceWith($(response.message));
inc/attributes/course.php CHANGED
@@ -228,7 +228,7 @@ if ( !class_exists( 'LP_Course_Attributes' ) ) {
228
  'edit' => sprintf(
229
  '<a href="%s" aria-label="%s" >%s </a > ',
230
  esc_url( $edit_link ),
231
- esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $tax->name ) ),
232
  __( 'Edit', 'learnpress' )
233
  ),
234
  'delete' => sprintf(
228
  'edit' => sprintf(
229
  '<a href="%s" aria-label="%s" >%s </a > ',
230
  esc_url( $edit_link ),
231
+ esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;', 'learnpress' ), $tax->name ) ),
232
  __( 'Edit', 'learnpress' )
233
  ),
234
  'delete' => sprintf(
inc/curds/class-lp-user-curd.php CHANGED
@@ -125,51 +125,51 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
125
  * @return array|mixed
126
  */
127
  public function get_orders( $user_id, $args = array() ) {
128
-
129
  // If user does not exists
130
  if ( ! $user_id || ! $user = learn_press_get_user( $user_id ) ) {
131
  return false;
132
  }
133
-
134
  $cache_key = false;
135
  if ( $args ) {
136
  $args = wp_parse_args(
137
- $args,
138
- array(
139
- 'group_by_order' => false,
140
- 'status' => ''
141
- )
142
- );
143
-
144
  ksort( $args );
145
  $cache_key = md5( serialize( $args ) );
146
-
147
  /**
148
  * Get orders from cache by args
149
  */
150
  if ( false !== ( $orders = LP_Object_Cache::get( "user-{$user_id}-" . $cache_key, 'lp-user-orders' ) ) ) {
151
  LP_Debug::log_function( __CLASS__ . '::' . __FUNCTION__ );
152
-
153
  return $orders;
154
  }
155
  }
156
  // Get orders for the user from cache
157
  $orders = LP_Object_Cache::get( 'user-' . $user_id, 'lp-user-orders' );
158
-
159
  if ( false === $orders ) {
160
  global $wpdb;
161
-
162
  $orders = array();
163
  $post_status_in = learn_press_get_order_statuses( true, true );
164
  $post_status_in_format = array_fill( 0, sizeof( $post_status_in ), '%s' );
165
-
166
  // Get order by user
167
  $sql_orders = $wpdb->prepare( "
168
  SELECT p.*
169
  FROM {$wpdb->posts} p
170
  INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id AND meta_key = %s AND meta_value = %d
171
  ", '_user_id', $user_id );
172
-
173
  /**
174
  * Get order checked out by Guest but with the email of the user are getting
175
  */
@@ -179,7 +179,7 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
179
  INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id AND meta_key = %s AND meta_value = %s
180
  LEFT JOIN {$wpdb->postmeta} pmu ON p.ID = pmu.post_id AND pmu.meta_key = %s AND pmu.meta_value IS NULL
181
  ", '_checkout_email', $user->get_email(), '_user_id' );
182
-
183
  /**
184
  * The rest
185
  */
@@ -188,22 +188,22 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
188
  AND p.post_status IN(" . join( ',', $post_status_in_format ) . ")
189
  ORDER BY ID DESC
190
  ", array_merge( array(
191
- LP_ORDER_CPT
192
  ), $post_status_in ) );
193
-
194
  $sql = $sql_orders . " UNION " . $sql_guest_orders . $sql_rest;
195
-
196
  if ( $order_posts = $wpdb->get_results( $sql ) ) {
197
  $order_ids = array();
198
  foreach ( $order_posts as $order_post ) {
199
-
200
  // Put post into cache to user later ... maybe.
201
  $_post = sanitize_post( $order_post, 'raw' );
202
  wp_cache_add( $_post->ID, $_post, 'posts' );
203
-
204
  $order_ids[] = $_post->ID;
205
  }
206
-
207
  $order_ids_format = array_fill( 0, sizeof( $order_ids ), '%d' );
208
  $query = $wpdb->prepare( "
209
  SELECT meta_value as course_id, order_id
@@ -212,7 +212,7 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
212
  WHERE oi.order_id IN (" . join( ',', $order_ids_format ) . ")
213
  ORDER BY FIELD(order_id, " . join( ',', $order_ids_format ) . ")
214
  ", array_merge( array( '_course_id' ), $order_ids, $order_ids ) );
215
-
216
  if ( $results = $wpdb->get_results( $query ) ) {
217
  foreach ( $results as $result ) {
218
  if ( empty( $orders[ $result->course_id ] ) ) {
@@ -225,11 +225,11 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
225
  // Store to cache
226
  LP_Object_Cache::set( 'user-' . $user_id, $orders, 'lp-user-orders' );
227
  }
228
-
229
  if ( $orders ) {
230
  if ( array_key_exists( 'status', $args ) && $args['status'] ) {
231
  LP_Helper::sanitize_order_status( $args['status'] );
232
-
233
  $statuses = (array) $args['status'];
234
  foreach ( $orders as $course_id => $order_ids ) {
235
  $orders[ $course_id ] = array();
@@ -240,18 +240,18 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
240
  }
241
  }
242
  }
243
-
244
  if ( array_key_exists( 'group_by_order', $args ) && $args['group_by_order'] ) {
245
  $this->_group_orders( $orders );
246
  }
247
  }
248
-
249
  if ( $cache_key ) {
250
  LP_Object_Cache::set( "user-{$user_id}-" . $cache_key, $orders, 'lp-user-orders' );
251
  }
252
-
253
  LP_Debug::log_function( __CLASS__ . '::' . __FUNCTION__ );
254
-
255
  return $orders;
256
  }
257
 
@@ -1315,7 +1315,7 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
1315
  * Get an array of all orders are completed with keys are id of
1316
  * courses
1317
  */
1318
- $orders = $this->get_orders( $user_id, array( 'status' => 'completed' ) );
1319
 
1320
  if ( ! $orders ) {
1321
  throw new Exception( "", 0 );
@@ -1348,7 +1348,7 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
1348
  $from = "FROM {$wpdb->learnpress_user_items} ui";
1349
 
1350
  // JOIN
1351
- $join = "INNER JOIN {$wpdb->posts} c ON c.ID = ui.item_id";
1352
 
1353
  // WHERE
1354
  $where = $wpdb->prepare( "
@@ -1652,7 +1652,7 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
1652
  ) );
1653
  break;
1654
  }
1655
- }else {
1656
 
1657
  $having .= $wpdb->prepare( " AND X.status IN( %s, %s )", array(
1658
  'started',
125
  * @return array|mixed
126
  */
127
  public function get_orders( $user_id, $args = array() ) {
128
+
129
  // If user does not exists
130
  if ( ! $user_id || ! $user = learn_press_get_user( $user_id ) ) {
131
  return false;
132
  }
133
+
134
  $cache_key = false;
135
  if ( $args ) {
136
  $args = wp_parse_args(
137
+ $args,
138
+ array(
139
+ 'group_by_order' => false,
140
+ 'status' => ''
141
+ )
142
+ );
143
+
144
  ksort( $args );
145
  $cache_key = md5( serialize( $args ) );
146
+
147
  /**
148
  * Get orders from cache by args
149
  */
150
  if ( false !== ( $orders = LP_Object_Cache::get( "user-{$user_id}-" . $cache_key, 'lp-user-orders' ) ) ) {
151
  LP_Debug::log_function( __CLASS__ . '::' . __FUNCTION__ );
152
+
153
  return $orders;
154
  }
155
  }
156
  // Get orders for the user from cache
157
  $orders = LP_Object_Cache::get( 'user-' . $user_id, 'lp-user-orders' );
158
+
159
  if ( false === $orders ) {
160
  global $wpdb;
161
+
162
  $orders = array();
163
  $post_status_in = learn_press_get_order_statuses( true, true );
164
  $post_status_in_format = array_fill( 0, sizeof( $post_status_in ), '%s' );
165
+
166
  // Get order by user
167
  $sql_orders = $wpdb->prepare( "
168
  SELECT p.*
169
  FROM {$wpdb->posts} p
170
  INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id AND meta_key = %s AND meta_value = %d
171
  ", '_user_id', $user_id );
172
+
173
  /**
174
  * Get order checked out by Guest but with the email of the user are getting
175
  */
179
  INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id AND meta_key = %s AND meta_value = %s
180
  LEFT JOIN {$wpdb->postmeta} pmu ON p.ID = pmu.post_id AND pmu.meta_key = %s AND pmu.meta_value IS NULL
181
  ", '_checkout_email', $user->get_email(), '_user_id' );
182
+
183
  /**
184
  * The rest
185
  */
188
  AND p.post_status IN(" . join( ',', $post_status_in_format ) . ")
189
  ORDER BY ID DESC
190
  ", array_merge( array(
191
+ LP_ORDER_CPT
192
  ), $post_status_in ) );
193
+
194
  $sql = $sql_orders . " UNION " . $sql_guest_orders . $sql_rest;
195
+
196
  if ( $order_posts = $wpdb->get_results( $sql ) ) {
197
  $order_ids = array();
198
  foreach ( $order_posts as $order_post ) {
199
+
200
  // Put post into cache to user later ... maybe.
201
  $_post = sanitize_post( $order_post, 'raw' );
202
  wp_cache_add( $_post->ID, $_post, 'posts' );
203
+
204
  $order_ids[] = $_post->ID;
205
  }
206
+
207
  $order_ids_format = array_fill( 0, sizeof( $order_ids ), '%d' );
208
  $query = $wpdb->prepare( "
209
  SELECT meta_value as course_id, order_id
212
  WHERE oi.order_id IN (" . join( ',', $order_ids_format ) . ")
213
  ORDER BY FIELD(order_id, " . join( ',', $order_ids_format ) . ")
214
  ", array_merge( array( '_course_id' ), $order_ids, $order_ids ) );
215
+
216
  if ( $results = $wpdb->get_results( $query ) ) {
217
  foreach ( $results as $result ) {
218
  if ( empty( $orders[ $result->course_id ] ) ) {
225
  // Store to cache
226
  LP_Object_Cache::set( 'user-' . $user_id, $orders, 'lp-user-orders' );
227
  }
228
+
229
  if ( $orders ) {
230
  if ( array_key_exists( 'status', $args ) && $args['status'] ) {
231
  LP_Helper::sanitize_order_status( $args['status'] );
232
+
233
  $statuses = (array) $args['status'];
234
  foreach ( $orders as $course_id => $order_ids ) {
235
  $orders[ $course_id ] = array();
240
  }
241
  }
242
  }
243
+
244
  if ( array_key_exists( 'group_by_order', $args ) && $args['group_by_order'] ) {
245
  $this->_group_orders( $orders );
246
  }
247
  }
248
+
249
  if ( $cache_key ) {
250
  LP_Object_Cache::set( "user-{$user_id}-" . $cache_key, $orders, 'lp-user-orders' );
251
  }
252
+
253
  LP_Debug::log_function( __CLASS__ . '::' . __FUNCTION__ );
254
+
255
  return $orders;
256
  }
257
 
1315
  * Get an array of all orders are completed with keys are id of
1316
  * courses
1317
  */
1318
+ $orders = $this->get_orders( $user_id, array( 'status' => 'completed' ) );
1319
 
1320
  if ( ! $orders ) {
1321
  throw new Exception( "", 0 );
1348
  $from = "FROM {$wpdb->learnpress_user_items} ui";
1349
 
1350
  // JOIN
1351
+ $join = $wpdb->prepare( "INNER JOIN {$wpdb->posts} c ON c.ID = ui.item_id AND c.post_type = %s", LP_COURSE_CPT );
1352
 
1353
  // WHERE
1354
  $where = $wpdb->prepare( "
1652
  ) );
1653
  break;
1654
  }
1655
+ } else {
1656
 
1657
  $having .= $wpdb->prepare( " AND X.status IN( %s, %s )", array(
1658
  'started',
inc/custom-post-types/course.php CHANGED
@@ -1268,8 +1268,6 @@ if ( ! class_exists( 'LP_Course_Post_Type' ) ) {
1268
  $end = strtotime( $sale_price_end );
1269
  $start = strtotime( $sale_price_start );
1270
 
1271
- learn_press_debug($now, $sale_price_end, $sale_price_start, $end,$start);
1272
-
1273
  return ( ( $sale_price_start ) && ( $now <= $end || ! $sale_price_end ) || ( ! $sale_price_start && ! $sale_price_end ) );
1274
  }
1275
 
1268
  $end = strtotime( $sale_price_end );
1269
  $start = strtotime( $sale_price_start );
1270
 
 
 
1271
  return ( ( $sale_price_start ) && ( $now <= $end || ! $sale_price_end ) || ( ! $sale_price_start && ! $sale_price_end ) );
1272
  }
1273
 
inc/lp-constants.php CHANGED
@@ -4,7 +4,7 @@
4
  */
5
  $upload_dir = wp_upload_dir();
6
  // version
7
- define( 'LEARNPRESS_VERSION', '3.2.5.5' );
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.2.5.6' );
8
 
9
  define( 'LP_WP_CONTENT', basename( WP_CONTENT_DIR ) );
10
 
inc/lp-core-functions.php CHANGED
@@ -1316,7 +1316,7 @@ function learn_press_currency_symbols() {
1316
  'RON' => '&#108;&#101;&#105;',
1317
  'RSD' => '&#1044;&#1080;&#1085;&#46;',
1318
  'RUB' => '&#1088;&#1091;&#1073;',
1319
- 'RWF' => '&#1585;.&#1587;',
1320
  'SAR' => '&#65020;',
1321
  'SBD' => '&#36;',
1322
  'SCR' => '&#8360;',
1316
  'RON' => '&#108;&#101;&#105;',
1317
  'RSD' => '&#1044;&#1080;&#1085;&#46;',
1318
  'RUB' => '&#1088;&#1091;&#1073;',
1319
+ 'RWF' => 'R₣',
1320
  'SAR' => '&#65020;',
1321
  'SBD' => '&#36;',
1322
  'SCR' => '&#8360;',
inc/order/class-lp-order.php CHANGED
@@ -144,7 +144,7 @@ if ( ! class_exists( 'LP_Order' ) ) {
144
  $time_diff = time() - $time;
145
 
146
  if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) {
147
- $date = sprintf( __( '%s ago' ), human_time_diff( $time ) );
148
  } else {
149
  $date = mysql2date( get_option( 'date_format' ), $m_time );
150
  }
144
  $time_diff = time() - $time;
145
 
146
  if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) {
147
+ $date = sprintf( __( '%s ago', 'learnpress' ), human_time_diff( $time ) );
148
  } else {
149
  $date = mysql2date( get_option( 'date_format' ), $m_time );
150
  }
inc/updates/learnpress-update-3.0.0.php CHANGED
@@ -243,7 +243,7 @@ class LP_Update_30 extends LP_Update_Base {
243
 
244
  global $wpdb;
245
 
246
- echo $query = $wpdb->prepare( "
247
  INSERT INTO {$wpdb->learnpress_user_itemmeta}( `learnpress_user_item_id`, `meta_key`, `meta_value` )
248
  SELECT user_item_id, %s, COUNT(user_item_id) - 1 Y
249
  FROM (
@@ -257,6 +257,8 @@ class LP_Update_30 extends LP_Update_Base {
257
 
258
  $wpdb->query( $query );
259
 
 
 
260
  return false;
261
  }
262
 
243
 
244
  global $wpdb;
245
 
246
+ $query = $wpdb->prepare( "
247
  INSERT INTO {$wpdb->learnpress_user_itemmeta}( `learnpress_user_item_id`, `meta_key`, `meta_value` )
248
  SELECT user_item_id, %s, COUNT(user_item_id) - 1 Y
249
  FROM (
257
 
258
  $wpdb->query( $query );
259
 
260
+ $this->output($query);
261
+
262
  return false;
263
  }
264
 
inc/updates/learnpress-update-base.php CHANGED
@@ -85,14 +85,14 @@ class LP_Update_Base {
85
  if ( $callback == $step ) {
86
  if ( is_callable( array( $this, $callback ) ) ) {
87
 
88
- echo "Running " . get_class( $this ) . '::' . $callback, "\n";
89
  update_option( 'learnpress_updater_running_step', $step );
90
  if ( $return = call_user_func( array( $this, $callback ) ) ) {
91
  $this->_next_step();
92
  }
93
 
94
  } else {
95
- echo "$callback failed";
96
  $this->_next_step();
97
  }
98
 
@@ -103,13 +103,13 @@ class LP_Update_Base {
103
  }
104
 
105
  if ( ! $called ) {
106
- echo "Step {$step} not found";
107
  $this->_next_step();
108
  }
109
 
110
  }
111
  catch ( Exception $exception ) {
112
- echo $exception->getMessage();
113
  LP_Debug::rollbackTransaction();
114
  }
115
 
@@ -140,6 +140,14 @@ class LP_Update_Base {
140
  return $step === $end_step;
141
  }
142
 
 
 
 
 
 
 
 
 
143
  /**
144
  * Move to next step
145
  */
85
  if ( $callback == $step ) {
86
  if ( is_callable( array( $this, $callback ) ) ) {
87
 
88
+ $this->output( "Running " . get_class( $this ) . '::' . $callback . "\n" );
89
  update_option( 'learnpress_updater_running_step', $step );
90
  if ( $return = call_user_func( array( $this, $callback ) ) ) {
91
  $this->_next_step();
92
  }
93
 
94
  } else {
95
+ $this->output( "$callback failed" );
96
  $this->_next_step();
97
  }
98
 
103
  }
104
 
105
  if ( ! $called ) {
106
+ $this->output( "Step {$step} not found" );
107
  $this->_next_step();
108
  }
109
 
110
  }
111
  catch ( Exception $exception ) {
112
+ $this->output( $exception->getMessage() );
113
  LP_Debug::rollbackTransaction();
114
  }
115
 
140
  return $step === $end_step;
141
  }
142
 
143
+ protected function output( $content ) {
144
+ if ( ! learn_press_is_ajax() ) {
145
+ return;
146
+ }
147
+
148
+ print_r( $content );
149
+ }
150
+
151
  /**
152
  * Move to next step
153
  */
inc/user-item/class-lp-user-item.php CHANGED
@@ -157,7 +157,7 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
157
  $time_diff = time() - $time;
158
 
159
  if ( $human_diff_time && $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) {
160
- $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
161
  } else {
162
  $h_time = mysql2date( $format, $m_time );
163
  }
157
  $time_diff = time() - $time;
158
 
159
  if ( $human_diff_time && $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) {
160
+ $h_time = sprintf( __( '%s ago', 'learnpress' ), human_time_diff( $time ) );
161
  } else {
162
  $h_time = mysql2date( $format, $m_time );
163
  }
learnpress.php CHANGED
@@ -4,10 +4,10 @@ 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.2.5.5
8
  Author URI: http://thimpress.com
9
  Requires at least: 3.8
10
- Tested up to: 5.2
11
 
12
  Text Domain: learnpress
13
  Domain Path: /languages/
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.2.5.6
8
  Author URI: http://thimpress.com
9
  Requires at least: 3.8
10
+ Tested up to: 5.0.2
11
 
12
  Text Domain: learnpress
13
  Domain Path: /languages/
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: thimpress, tunnhn, phonglq.foobla, thongta, kendy73, leehld
3
  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: 5.2
7
- Stable tag: 3.2.5.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -199,6 +199,13 @@ https://www.transifex.com/projects/p/learnpress/
199
  8. Add-ons of LearnPress.
200
 
201
  == Changelog ==
 
 
 
 
 
 
 
202
  = 3.2.5.5 =
203
  ~ Fixed guest can not start quiz with no require enroll course option.
204
  ~ Fixed sql to filter orders by user ID.
3
  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: 5.0.2
7
+ Stable tag: 3.2.5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
199
  8. Add-ons of LearnPress.
200
 
201
  == Changelog ==
202
+ = 3.2.5.6 =
203
+ ~ Added new strings for translating.
204
+ ~ Corrected currency of Rwandan franc.
205
+ ~ Fixed missing utils library when adding manually the orders.
206
+ ~ Fixed upgrade function that doesn't hide the message when it done.
207
+ ~ Fixed can't create new page in settings.
208
+
209
  = 3.2.5.5 =
210
  ~ Fixed guest can not start quiz with no require enroll course option.
211
  ~ Fixed sql to filter orders by user ID.
templates/checkout/form-logged-in.php CHANGED
@@ -24,7 +24,7 @@ global $user_identity;
24
  ?>
25
 
26
  <p>
27
- <?php printf( __( 'Logged in as <a href="%1$s">%2$s</a>.' ), get_edit_user_link(), $user_identity ); ?>
28
 
29
  <a href="<?php echo wp_logout_url( get_permalink() ); ?>"
30
  title="<?php esc_attr_e( 'Log out of this account', 'learnpress' ); ?>"><?php _e( 'Log out &raquo;', 'learnpress' ); ?></a>
24
  ?>
25
 
26
  <p>
27
+ <?php printf( __( 'Logged in as <a href="%1$s">%2$s</a>.', 'learnpress' ), get_edit_user_link(), $user_identity ); ?>
28
 
29
  <a href="<?php echo wp_logout_url( get_permalink() ); ?>"
30
  title="<?php esc_attr_e( 'Log out of this account', 'learnpress' ); ?>"><?php _e( 'Log out &raquo;', 'learnpress' ); ?></a>
templates/widgets/popular-courses/default.php CHANGED
@@ -30,7 +30,9 @@ $instance = $this->instance;
30
 
31
  <div class="widget-body">
32
  <?php foreach ( $courses as $course_id ) {
33
-
 
 
34
  $post = get_post( $course_id );
35
  setup_postdata( $post );
36
  $course = learn_press_get_course( $course_id );
30
 
31
  <div class="widget-body">
32
  <?php foreach ( $courses as $course_id ) {
33
+ if ( ! $course_id ) {
34
+ continue;
35
+ }
36
  $post = get_post( $course_id );
37
  setup_postdata( $post );
38
  $course = learn_press_get_course( $course_id );