Tutor LMS – eLearning and online course solution - Version 1.6.8

Version Description

  • July 30, 2020 =

Fix: WooCommerce enrollment issue

Download this release

Release Info

Developer themeum
Plugin Icon wp plugin Tutor LMS – eLearning and online course solution
Version 1.6.8
Comparing to
See all releases

Code changes from version 1.6.7 to 1.6.8

Files changed (3) hide show
  1. classes/WooCommerce.php +20 -21
  2. readme.txt +5 -1
  3. tutor.php +2 -2
classes/WooCommerce.php CHANGED
@@ -47,7 +47,7 @@ class WooCommerce extends Tutor_Base {
47
  * After place new order
48
  */
49
  add_action('woocommerce_new_order', array($this, 'course_placing_order_from_admin'), 10, 3);
50
- add_action('woocommerce_thankyou', array($this, 'course_placing_order_from_customer'), 10, 3);
51
 
52
  /**
53
  * Order Status Hook
@@ -422,7 +422,17 @@ class WooCommerce extends Tutor_Base {
422
  if (!is_admin()) {
423
  return;
424
  }
425
- $this->enroll_course_by_order_id($order_id);
 
 
 
 
 
 
 
 
 
 
426
  }
427
 
428
  /**
@@ -431,29 +441,18 @@ class WooCommerce extends Tutor_Base {
431
  * @param $order_id
432
  * @since v.1.6.7
433
  */
434
- public function course_placing_order_from_customer($order_id) {
435
  if (is_admin()) {
436
  return;
437
  }
438
- $this->enroll_course_by_order_id($order_id);
439
- }
440
 
441
- /**
442
- * Enroll course by order id
443
- *
444
- * @param $order_id
445
- * @since v.1.6.7
446
- */
447
- public function enroll_course_by_order_id($order_id) {
448
- $order = wc_get_order( $order_id );
449
- foreach ($order->get_items() as $item) {
450
- $product_id = $item->get_product_id();
451
- $if_has_course = tutor_utils()->product_belongs_with_course($product_id);
452
- if ($if_has_course) {
453
- $course_id = $if_has_course->post_id;
454
- $customer_id = $order->get_customer_id();
455
- tutor_utils()->do_enroll($course_id, $order_id, $customer_id);
456
- }
457
  }
458
  }
459
  }
47
  * After place new order
48
  */
49
  add_action('woocommerce_new_order', array($this, 'course_placing_order_from_admin'), 10, 3);
50
+ add_action('woocommerce_new_order_item', array($this, 'course_placing_order_from_customer'), 10, 3);
51
 
52
  /**
53
  * Order Status Hook
422
  if (!is_admin()) {
423
  return;
424
  }
425
+
426
+ $order = wc_get_order( $order_id );
427
+ foreach ($order->get_items() as $item) {
428
+ $product_id = $item->get_product_id();
429
+ $if_has_course = tutor_utils()->product_belongs_with_course($product_id);
430
+ if ($if_has_course) {
431
+ $course_id = $if_has_course->post_id;
432
+ $customer_id = $order->get_customer_id();
433
+ tutor_utils()->do_enroll($course_id, $order_id, $customer_id);
434
+ }
435
+ }
436
  }
437
 
438
  /**
441
  * @param $order_id
442
  * @since v.1.6.7
443
  */
444
+ public function course_placing_order_from_customer($item_id, $item, $order_id) {
445
  if (is_admin()) {
446
  return;
447
  }
 
 
448
 
449
+ $item = new \WC_Order_Item_Product($item);
450
+ $product_id = $item->get_product_id();
451
+ $if_has_course = tutor_utils()->product_belongs_with_course($product_id);
452
+
453
+ if ($if_has_course){
454
+ $course_id = $if_has_course->post_id;
455
+ tutor_utils()->do_enroll($course_id, $order_id);
 
 
 
 
 
 
 
 
 
456
  }
457
  }
458
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: lms, course, elearning, education, learning management system
5
  Requires at least: 4.5
6
  Tested up to: 5.4
7
  Requires PHP: 5.4.0
8
- Stable tag: 1.6.7
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -241,6 +241,10 @@ Tutor enables you to use any third party plugins without facing any compatibilit
241
 
242
  == Changelog ==
243
 
 
 
 
 
244
  = 1.6.7 - July 28, 2020 =
245
 
246
  Update: Admins/instructors can view their course content from the front-end
5
  Requires at least: 4.5
6
  Tested up to: 5.4
7
  Requires PHP: 5.4.0
8
+ Stable tag: 1.6.8
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
241
 
242
  == Changelog ==
243
 
244
+ = 1.6.8 - July 30, 2020 =
245
+
246
+ Fix: WooCommerce enrollment issue
247
+
248
  = 1.6.7 - July 28, 2020 =
249
 
250
  Update: Admins/instructors can view their course content from the front-end
tutor.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Tutor LMS
4
  Plugin URI: https://www.themeum.com/product/tutor-lms/
5
  Description: Tutor is a complete solution for creating a Learning Management System in WordPress way. It can help you to create small to large scale online education site very conveniently. Power features like report, certificate, course preview, private file sharing make Tutor a robust plugin for any educational institutes.
6
  Author: Themeum
7
- Version: 1.6.7
8
  Author URI: https://themeum.com
9
  Requires at least: 4.5
10
  Tested up to: 5.3
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) )
17
  /**
18
  * Defined the tutor main file
19
  */
20
- define('TUTOR_VERSION', '1.6.7');
21
  define('TUTOR_FILE', __FILE__);
22
 
23
  /**
4
  Plugin URI: https://www.themeum.com/product/tutor-lms/
5
  Description: Tutor is a complete solution for creating a Learning Management System in WordPress way. It can help you to create small to large scale online education site very conveniently. Power features like report, certificate, course preview, private file sharing make Tutor a robust plugin for any educational institutes.
6
  Author: Themeum
7
+ Version: 1.6.8
8
  Author URI: https://themeum.com
9
  Requires at least: 4.5
10
  Tested up to: 5.3
17
  /**
18
  * Defined the tutor main file
19
  */
20
+ define('TUTOR_VERSION', '1.6.8');
21
  define('TUTOR_FILE', __FILE__);
22
 
23
  /**