Tutor LMS – eLearning and online course solution - Version 1.0.5

Version Description

  • 18 March, 2019 =

  • Updated Rating and review, added individual 5 stars, 4 stars, 3 stars, 2 stars, 1 star rating count with the meter

Download this release

Release Info

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

Code changes from version 1.0.4 to 1.0.5

assets/css/tutor-front.css CHANGED
@@ -2746,8 +2746,31 @@ Course question and answer
2746
  margin-right: 4px;
2747
  color: #F8C51C;
2748
  }
2749
-
2750
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2751
 
2752
  /* ********************* */
2753
  /* Tutor Pagination Wrap */
2746
  margin-right: 4px;
2747
  color: #F8C51C;
2748
  }
2749
+ .course-rating-meter {
2750
+ display: flex;
2751
+ }
2752
+ .course-rating-meter i.tutor-icon-star-full{
2753
+ color: #F8C51C;
2754
+ }
2755
+ .rating-meter-bar-wrap{
2756
+ flex: 1;
2757
+ }
2758
+ .rating-meter-col{
2759
+ margin: 0 3px;
2760
+ }
2761
+ .rating-meter-bar {
2762
+ height: 10px;
2763
+ width: 100%;
2764
+ background: #E8EFF1;
2765
+ margin-top: 6px;
2766
+ }
2767
+ .rating-meter-fill-bar {
2768
+ background: #F8C51C;
2769
+ height: 10px;
2770
+ }
2771
+ .rating-meter-col.rating-text-col{
2772
+ flex: 0 0 100px;
2773
+ }
2774
 
2775
  /* ********************* */
2776
  /* Tutor Pagination Wrap */
classes/Utils.php CHANGED
@@ -2269,25 +2269,69 @@ class Utils {
2269
  'rating_count' => 0,
2270
  'rating_sum' => 0,
2271
  'rating_avg' => 0.00,
 
2272
  );
2273
 
2274
  global $wpdb;
2275
 
2276
- $rating = $wpdb->get_row("select COUNT(meta_value) as rating_count, SUM(meta_value) as rating_sum from {$wpdb->comments}
 
2277
  INNER JOIN {$wpdb->commentmeta}
2278
  ON {$wpdb->comments}.comment_ID = {$wpdb->commentmeta}.comment_id
2279
  WHERE {$wpdb->comments}.comment_post_ID = {$course_id}
 
2280
  AND meta_key = 'tutor_rating' ;"
2281
  );
2282
 
2283
  if ($rating->rating_count){
2284
  $avg_rating = number_format(($rating->rating_sum / $rating->rating_count), 2);
2285
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2286
  $ratings = array(
2287
  'rating_count' => $rating->rating_count,
2288
  'rating_sum' => $rating->rating_sum,
2289
  'rating_avg' => $avg_rating,
 
2290
  );
 
2291
  }
2292
 
2293
  return (object) $ratings;
2269
  'rating_count' => 0,
2270
  'rating_sum' => 0,
2271
  'rating_avg' => 0.00,
2272
+ 'count_by_value' => array(5 => 0, 4 => 0, 3 => 0, 2 => 0, 1 => 0)
2273
  );
2274
 
2275
  global $wpdb;
2276
 
2277
+ $rating = $wpdb->get_row("select COUNT(meta_value) as rating_count, SUM(meta_value) as rating_sum
2278
+ from {$wpdb->comments}
2279
  INNER JOIN {$wpdb->commentmeta}
2280
  ON {$wpdb->comments}.comment_ID = {$wpdb->commentmeta}.comment_id
2281
  WHERE {$wpdb->comments}.comment_post_ID = {$course_id}
2282
+ AND {$wpdb->comments}.comment_type = 'tutor_course_rating'
2283
  AND meta_key = 'tutor_rating' ;"
2284
  );
2285
 
2286
  if ($rating->rating_count){
2287
  $avg_rating = number_format(($rating->rating_sum / $rating->rating_count), 2);
2288
 
2289
+ /**
2290
+ * Get individual Rating by integer
2291
+ */
2292
+ $five_stars_count = $wpdb->get_var("select COUNT(meta_value) as rating_count
2293
+ from {$wpdb->comments}
2294
+ INNER JOIN {$wpdb->commentmeta} ON {$wpdb->comments}.comment_ID = {$wpdb->commentmeta}.comment_id
2295
+ WHERE {$wpdb->comments}.comment_post_ID = {$course_id}
2296
+ AND {$wpdb->comments}.comment_type = 'tutor_course_rating'
2297
+ AND meta_key = 'tutor_rating' AND meta_value = 5 ;"
2298
+ );
2299
+ $four_stars_count = $wpdb->get_var("select COUNT(meta_value) as rating_count
2300
+ from {$wpdb->comments}
2301
+ INNER JOIN {$wpdb->commentmeta} ON {$wpdb->comments}.comment_ID = {$wpdb->commentmeta}.comment_id
2302
+ WHERE {$wpdb->comments}.comment_post_ID = {$course_id}
2303
+ AND {$wpdb->comments}.comment_type = 'tutor_course_rating'
2304
+ AND meta_key = 'tutor_rating' AND meta_value = 4 ;"
2305
+ );
2306
+ $three_stars_count = $wpdb->get_var("select COUNT(meta_value) as rating_count
2307
+ from {$wpdb->comments}
2308
+ INNER JOIN {$wpdb->commentmeta} ON {$wpdb->comments}.comment_ID = {$wpdb->commentmeta}.comment_id
2309
+ WHERE {$wpdb->comments}.comment_post_ID = {$course_id}
2310
+ AND {$wpdb->comments}.comment_type = 'tutor_course_rating'
2311
+ AND meta_key = 'tutor_rating' AND meta_value = 3 ;"
2312
+ );
2313
+ $two_stars_count = $wpdb->get_var("select COUNT(meta_value) as rating_count
2314
+ from {$wpdb->comments}
2315
+ INNER JOIN {$wpdb->commentmeta} ON {$wpdb->comments}.comment_ID = {$wpdb->commentmeta}.comment_id
2316
+ WHERE {$wpdb->comments}.comment_post_ID = {$course_id}
2317
+ AND {$wpdb->comments}.comment_type = 'tutor_course_rating'
2318
+ AND meta_key = 'tutor_rating' AND meta_value = 2 ;"
2319
+ );
2320
+ $one_stars_count = $wpdb->get_var("select COUNT(meta_value) as rating_count
2321
+ from {$wpdb->comments}
2322
+ INNER JOIN {$wpdb->commentmeta} ON {$wpdb->comments}.comment_ID = {$wpdb->commentmeta}.comment_id
2323
+ WHERE {$wpdb->comments}.comment_post_ID = {$course_id}
2324
+ AND {$wpdb->comments}.comment_type = 'tutor_course_rating'
2325
+ AND meta_key = 'tutor_rating' AND meta_value = 1 ;"
2326
+ );
2327
+
2328
  $ratings = array(
2329
  'rating_count' => $rating->rating_count,
2330
  'rating_sum' => $rating->rating_sum,
2331
  'rating_avg' => $avg_rating,
2332
+ 'count_by_value' => array(5 => $five_stars_count, 4 => $four_stars_count, 3 => $three_stars_count, 2 => $two_stars_count, 1 => $one_stars_count)
2333
  );
2334
+
2335
  }
2336
 
2337
  return (object) $ratings;
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: lms, education, wp-lms, education management system
5
  Requires at least: 4.5
6
  Tested up to: 5.1
7
  Requires PHP: 5.4.0
8
- Stable tag: 1.0.4
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -183,6 +183,9 @@ This is an alpha version of Tutor, as bugs and issues expected, if you found any
183
 
184
  == Changelog ==
185
 
 
 
 
186
 
187
  = 1.0.4 - 15 March, 2019 =
188
 
5
  Requires at least: 4.5
6
  Tested up to: 5.1
7
  Requires PHP: 5.4.0
8
+ Stable tag: 1.0.5
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
183
 
184
  == Changelog ==
185
 
186
+ = 1.0.5 - 18 March, 2019 =
187
+
188
+ * Updated Rating and review, added individual 5 stars, 4 stars, 3 stars, 2 stars, 1 star rating count with the meter
189
 
190
  = 1.0.4 - 15 March, 2019 =
191
 
templates/single/course/reviews.php CHANGED
@@ -30,18 +30,47 @@ if ( ! is_array($reviews) || ! count($reviews)){
30
  <div class="tutor-row tutor-align-items-center">
31
  <div class="tutor-col-auto">
32
  <p class="course-avg-rating">
33
- <?php
34
- $rating = tutor_utils()->get_course_rating();
35
- echo number_format($rating->rating_avg, 1);
36
- ?>
37
  </p>
38
- </div>
39
- <div class="tutor-col">
40
  <p class="course-avg-rating-html">
41
- <?php tutor_utils()->star_rating_generator($rating->rating_avg);?>
42
  </p>
43
  <p class="tutor-course-avg-rating-total">Total <span><?php echo $rating->rating_count;?></span> Ratings</p>
 
44
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  </div>
46
 
47
  </div>
30
  <div class="tutor-row tutor-align-items-center">
31
  <div class="tutor-col-auto">
32
  <p class="course-avg-rating">
33
+ <?php
34
+ $rating = tutor_utils()->get_course_rating();
35
+ echo number_format($rating->rating_avg, 1);
36
+ ?>
37
  </p>
38
+
39
+
40
  <p class="course-avg-rating-html">
41
+ <?php tutor_utils()->star_rating_generator($rating->rating_avg);?>
42
  </p>
43
  <p class="tutor-course-avg-rating-total">Total <span><?php echo $rating->rating_count;?></span> Ratings</p>
44
+
45
  </div>
46
+
47
+
48
+
49
+
50
+ <div class="tutor-col">
51
+ <div class="course-ratings-count-meter-wrap">
52
+ <?php
53
+ foreach ($rating->count_by_value as $key => $value){
54
+ $rating_count_percent = ($value > 0) ? ($value * 100 ) / $rating->rating_count : 0;
55
+ ?>
56
+ <div class="course-rating-meter">
57
+ <div class="rating-meter-col"><i class="tutor-icon-star-full"></i></div>
58
+ <div class="rating-meter-col"><?php echo $key; ?></div>
59
+ <div class="rating-meter-col rating-meter-bar-wrap">
60
+ <div class="rating-meter-bar">
61
+ <div class="rating-meter-fill-bar" style="width: <?php echo $rating_count_percent; ?>%;"></div>
62
+ </div>
63
+ </div>
64
+ <div class="rating-meter-col rating-text-col">
65
+ <?php
66
+ echo $value.' ';
67
+ echo $value > 1 ? __('ratings', 'tutor') : __('rating', 'tutor'); ?>
68
+ </div>
69
+ </div>
70
+ <?php } ?>
71
+ </div>
72
+ </div>
73
+
74
  </div>
75
 
76
  </div>
tutor.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://https://themeum.com/tutor
5
  Description: Tutor is a complete solution for creating a Learning Management System in WordPress way. It can help you to create
6
  courses, lessons and quizzes.
7
  Author: Themeum
8
- Version: 1.0.4
9
  Author URI: http://themeum.com
10
  Requires at least: 4.5
11
  Tested up to: 5.1
@@ -18,7 +18,7 @@ if ( ! defined( 'ABSPATH' ) )
18
  /**
19
  * Defined the tutor main file
20
  */
21
- define('TUTOR_VERSION', '1.0.4');
22
  define('TUTOR_FILE', __FILE__);
23
 
24
 
5
  Description: Tutor is a complete solution for creating a Learning Management System in WordPress way. It can help you to create
6
  courses, lessons and quizzes.
7
  Author: Themeum
8
+ Version: 1.0.5
9
  Author URI: http://themeum.com
10
  Requires at least: 4.5
11
  Tested up to: 5.1
18
  /**
19
  * Defined the tutor main file
20
  */
21
+ define('TUTOR_VERSION', '1.0.5');
22
  define('TUTOR_FILE', __FILE__);
23
 
24