Version Description
- Fixed bug with AJAX call when load more reviews.
Download this release
Release Info
Developer | leehld |
Plugin | LearnPress – Course Review |
Version | 3.0.1 |
Comparing to | |
See all releases |
Code changes from version 3.0.0 to 3.0.1
- assets/css/course-review.css +12 -8
- assets/js/course-review.js +157 -259
- inc/functions.php +5 -5
- inc/load.php +18 -3
- inc/widgets.php +26 -17
- languages/learnpress-course-review.pot +60 -40
- learnpress-course-review.php +3 -3
- readme.txt +5 -2
- templates/course-rate.php +1 -1
- templates/course-review.php +4 -3
- templates/loop-review.php +13 -13
- templates/rating-stars.php +1 -1
- templates/review-form.php +1 -1
- templates/shortcode-course-rate.php +1 -1
- templates/shortcode-course-review.php +6 -15
assets/css/course-review.css
CHANGED
@@ -213,12 +213,12 @@
|
|
213 |
margin-bottom: 0;
|
214 |
}
|
215 |
|
216 |
-
.course-reviews-list {
|
217 |
list-style: none;
|
218 |
margin: 0;
|
219 |
}
|
220 |
|
221 |
-
.course-reviews-list li {
|
222 |
margin-bottom: 20px;
|
223 |
padding: 20px;
|
224 |
background-color: #fafafa;
|
@@ -226,26 +226,26 @@
|
|
226 |
overflow: hidden;
|
227 |
}
|
228 |
|
229 |
-
.course-reviews-list li .review-author {
|
230 |
width: 80px;
|
231 |
float: left;
|
232 |
margin-right: 20px;
|
233 |
}
|
234 |
|
235 |
-
.course-reviews-list li .review-author-info {
|
236 |
float: left;
|
237 |
}
|
238 |
|
239 |
-
.course-reviews-list li .review-text {
|
240 |
width: -webkit-calc(100% - 100px);
|
241 |
float: right;
|
242 |
}
|
243 |
|
244 |
-
.course-reviews-list li .user-name {
|
245 |
margin: 5px;
|
246 |
}
|
247 |
|
248 |
-
.course-reviews-list li .review-title {
|
249 |
clear: both;
|
250 |
font-size: 14px;
|
251 |
font-style: italic;
|
@@ -255,8 +255,12 @@
|
|
255 |
}
|
256 |
|
257 |
@media (max-width: 600px) {
|
258 |
-
.course-reviews-list li .review-text {
|
259 |
width: 100%;
|
260 |
float: left;
|
261 |
}
|
262 |
}
|
|
|
|
|
|
|
|
213 |
margin-bottom: 0;
|
214 |
}
|
215 |
|
216 |
+
.course-reviews-list, .course-reviews-list-shortcode {
|
217 |
list-style: none;
|
218 |
margin: 0;
|
219 |
}
|
220 |
|
221 |
+
.course-reviews-list li, .course-reviews-list-shortcode li {
|
222 |
margin-bottom: 20px;
|
223 |
padding: 20px;
|
224 |
background-color: #fafafa;
|
226 |
overflow: hidden;
|
227 |
}
|
228 |
|
229 |
+
.course-reviews-list li .review-author, .course-reviews-list-shortcode li .review-author {
|
230 |
width: 80px;
|
231 |
float: left;
|
232 |
margin-right: 20px;
|
233 |
}
|
234 |
|
235 |
+
.course-reviews-list li .review-author-info .course-reviews-list-shortcode li .review-author-info {
|
236 |
float: left;
|
237 |
}
|
238 |
|
239 |
+
.course-reviews-list li .review-text, .course-reviews-list-shortcode li .review-text {
|
240 |
width: -webkit-calc(100% - 100px);
|
241 |
float: right;
|
242 |
}
|
243 |
|
244 |
+
.course-reviews-list li .user-name, .course-reviews-list-shortcode li .user-name {
|
245 |
margin: 5px;
|
246 |
}
|
247 |
|
248 |
+
.course-reviews-list li .review-title, .course-reviews-list-shortcode li .review-title {
|
249 |
clear: both;
|
250 |
font-size: 14px;
|
251 |
font-style: italic;
|
255 |
}
|
256 |
|
257 |
@media (max-width: 600px) {
|
258 |
+
.course-reviews-list li .review-text, .course-reviews-list-shortcode li .review-text {
|
259 |
width: 100%;
|
260 |
float: left;
|
261 |
}
|
262 |
}
|
263 |
+
|
264 |
+
.loading {
|
265 |
+
display: none;
|
266 |
+
}
|
assets/js/course-review.js
CHANGED
@@ -6,267 +6,165 @@
|
|
6 |
* @version 1.0
|
7 |
*/
|
8 |
;(function ($) {
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
135 |
|
136 |
})
|
137 |
(jQuery);
|
138 |
jQuery(document).ready(function ($) {
|
139 |
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
$(".close", $review).click(function (evt) {
|
172 |
-
evt.preventDefault();
|
173 |
-
close_form();
|
174 |
-
});
|
175 |
-
|
176 |
-
$('.cancel', $review).click(close_form);
|
177 |
-
|
178 |
-
$(document).keyup(function (e) {
|
179 |
-
if (e.keyCode == 27 && $review.is(':visible')) {
|
180 |
-
event.preventDefault();
|
181 |
-
close_form();
|
182 |
-
}
|
183 |
-
});
|
184 |
-
|
185 |
-
var stars = $('.review-fields ul > li span', $review).each(function (i) {
|
186 |
-
$(this).hover(function () {
|
187 |
-
stars.map(function (j) {
|
188 |
-
j <= i ? $(this).addClass('hover') : $(this).removeClass('hover');
|
189 |
-
})
|
190 |
-
}, function () {
|
191 |
-
var selected = $review.data('selected');
|
192 |
-
stars.map(function (j) {
|
193 |
-
j <= selected ? $(this).addClass('hover') : $(this).removeClass('hover');
|
194 |
-
})
|
195 |
-
}).click(function (e) {
|
196 |
-
e.preventDefault();
|
197 |
-
$review.data('selected', i)
|
198 |
-
});
|
199 |
-
})
|
200 |
-
|
201 |
-
$(document).on('click', '#course-review-load-more', function () {
|
202 |
-
var $button = $(this);
|
203 |
-
if (!$button.is(':visible')) return;
|
204 |
-
$button.hide();
|
205 |
-
var paged = parseInt($(this).attr('data-paged')) + 1;
|
206 |
-
$('#course-reviews .loading').show();
|
207 |
-
$.ajax({
|
208 |
-
type : "POST",
|
209 |
-
dataType: 'html',
|
210 |
-
url : window.location.href,
|
211 |
-
data : {
|
212 |
-
action: 'learn_press_load_course_review',
|
213 |
-
paged : paged
|
214 |
-
},
|
215 |
-
success : function (response) {
|
216 |
-
var $content = $(response),
|
217 |
-
$loading = $('#course-reviews .loading').hide();
|
218 |
-
$content.find('.course-reviews-list > li:not(.loading)').insertBefore($loading);
|
219 |
-
if ($content.find('#course-review-load-more').length) {
|
220 |
-
$button.show().attr('data-paged', paged);
|
221 |
-
} else {
|
222 |
-
$button.remove();
|
223 |
-
}
|
224 |
-
}
|
225 |
-
});
|
226 |
-
});
|
227 |
-
$('.submit-review').click(function (event) {
|
228 |
-
event.preventDefault();
|
229 |
-
|
230 |
-
var $review_title = $('input[name="review-title"]');
|
231 |
-
var $review_content = $('textarea[name="review-content"]');
|
232 |
-
var review_rate = $review.data('selected');
|
233 |
-
var course_id = $(this).attr('data-id');
|
234 |
-
|
235 |
-
if (0 == $review_title.val().length) {
|
236 |
-
alert('Please enter the review title')
|
237 |
-
$review_title.focus();
|
238 |
-
return;
|
239 |
-
}
|
240 |
-
|
241 |
-
if (0 == $review_content.val().length) {
|
242 |
-
alert('Please enter the review content')
|
243 |
-
$review_content.focus();
|
244 |
-
return;
|
245 |
-
}
|
246 |
-
|
247 |
-
if (review_rate == undefined) {
|
248 |
-
alert('Please select your rating')
|
249 |
-
return;
|
250 |
-
}
|
251 |
-
$review.block_ui();
|
252 |
-
$('.submitting', $review).show();
|
253 |
-
$.ajax({
|
254 |
-
type : "POST",
|
255 |
-
dataType: 'html',
|
256 |
-
url : ajaxurl,
|
257 |
-
data : {
|
258 |
-
action : 'learn_press_add_course_review',
|
259 |
-
review_rate : parseInt(review_rate) + 1,
|
260 |
-
review_title : $review_title.val(),
|
261 |
-
review_content: $review_content.val(),
|
262 |
-
course_id : course_id
|
263 |
-
},
|
264 |
-
success : function (html) {
|
265 |
-
$('.course-rate').replaceWith($(html))
|
266 |
-
$('.submitting', $review).hide();
|
267 |
-
$(".close", $review).trigger('click');
|
268 |
-
$('button.write-a-review').remove();
|
269 |
-
}
|
270 |
-
})
|
271 |
-
})
|
272 |
-
})
|
6 |
* @version 1.0
|
7 |
*/
|
8 |
;(function ($) {
|
9 |
+
if (typeof LP == 'undefined' && typeof LearnPress != 'undefined') {
|
10 |
+
window.LP = LearnPress;
|
11 |
+
}
|
12 |
+
|
13 |
+
function CourseReview() {
|
14 |
+
var $reviewForm = $('#course-review').appendTo(document.body),
|
15 |
+
$reviewBtn = $(".write-a-review"),
|
16 |
+
$stars = $('.review-fields ul > li span', $reviewForm).each(function (i) {
|
17 |
+
$(this).hover(function () {
|
18 |
+
if (submitting) {
|
19 |
+
return;
|
20 |
+
}
|
21 |
+
$stars.map(function (j) {
|
22 |
+
$(this).toggleClass('hover', j <= i);
|
23 |
+
})
|
24 |
+
}, function () {
|
25 |
+
if (submitting) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
var selected = $reviewForm.find('input[name="rating"]').val();
|
29 |
+
if (selected) {
|
30 |
+
$stars.map(function (j) {
|
31 |
+
$(this).toggleClass('hover', j < selected);
|
32 |
+
});
|
33 |
+
} else {
|
34 |
+
$stars.removeClass('hover')
|
35 |
+
}
|
36 |
+
}).click(function (e) {
|
37 |
+
if (submitting) {
|
38 |
+
return;
|
39 |
+
}
|
40 |
+
e.preventDefault();
|
41 |
+
$reviewForm.find('input[name="rating"]').val($stars.index($(this)) + 1);
|
42 |
+
})
|
43 |
+
}),
|
44 |
+
that = this,
|
45 |
+
submitting = false,
|
46 |
+
showForm = null,
|
47 |
+
closeForm = null,
|
48 |
+
addReview = null;
|
49 |
+
|
50 |
+
showForm = this.showForm = function () {
|
51 |
+
var _completed = function () {
|
52 |
+
$('input[type="text"], textarea', this).val('');
|
53 |
+
$stars.removeClass('hover');
|
54 |
+
}
|
55 |
+
$reviewForm.fadeIn(_completed);
|
56 |
+
}
|
57 |
+
|
58 |
+
closeForm = this.closeForm = function () {
|
59 |
+
var _completed = function () {
|
60 |
+
$('button, input[type="text"], textarea', $reviewForm).prop('disabled', false);
|
61 |
+
$reviewForm.removeClass('submitting').data('selected', '');
|
62 |
+
$stars.removeClass('hover')
|
63 |
+
}
|
64 |
+
$reviewForm.find('input[name="rating"]').val('')
|
65 |
+
$(document).focus();
|
66 |
+
$reviewForm.fadeOut(_completed);
|
67 |
+
}
|
68 |
+
|
69 |
+
addReview = this.addReview = function () {
|
70 |
+
var $reviewTitle = $('input[name="review_title"]', $reviewForm);
|
71 |
+
var $reviewContent = $('textarea[name="review_content"]', $reviewForm);
|
72 |
+
var rating = $reviewForm.find('input[name="rating"]').val();
|
73 |
+
var course_id = $(this).attr('data-id');
|
74 |
+
|
75 |
+
if (0 == $reviewTitle.val().length) {
|
76 |
+
alert(learn_press_course_review.localize.empty_title)
|
77 |
+
$reviewTitle.focus();
|
78 |
+
return;
|
79 |
+
}
|
80 |
+
|
81 |
+
if (0 == $reviewContent.val().length) {
|
82 |
+
alert(learn_press_course_review.localize.empty_content)
|
83 |
+
$reviewContent.focus();
|
84 |
+
return;
|
85 |
+
}
|
86 |
+
|
87 |
+
if (0 == rating) {
|
88 |
+
alert(learn_press_course_review.localize.empty_rating)
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
$reviewForm.addClass('submitting');
|
92 |
+
$.ajax({
|
93 |
+
url: window.location.href,
|
94 |
+
data: $('form', $reviewForm).serialize(),
|
95 |
+
dataType: 'text',
|
96 |
+
success: function (response) {
|
97 |
+
submitting = false;
|
98 |
+
response = LP.parseJSON(response);
|
99 |
+
if (response.result == 'success') {
|
100 |
+
closeForm();
|
101 |
+
LP.reload();
|
102 |
+
} else {
|
103 |
+
$('button, input[type="text"], textarea', $reviewForm).prop('disabled', false);
|
104 |
+
$reviewForm.removeClass('submitting').addClass('error');
|
105 |
+
$reviewForm.find('message').html(response.message);
|
106 |
+
}
|
107 |
+
},
|
108 |
+
error: function (response) {
|
109 |
+
response = LP.parseJSON(response);
|
110 |
+
submitting = false;
|
111 |
+
$('button, input[type="text"], textarea', $reviewForm).prop('disabled', false);
|
112 |
+
$reviewForm.removeClass('submitting').addClass('error');
|
113 |
+
$reviewForm.find('message').html(response.message);
|
114 |
+
}
|
115 |
+
});
|
116 |
+
$('button, input[type="text"], textarea', $reviewForm).prop('disabled', true);
|
117 |
+
|
118 |
+
}
|
119 |
+
|
120 |
+
$reviewBtn.click(function (e) {
|
121 |
+
e.preventDefault();
|
122 |
+
that.showForm();
|
123 |
+
});
|
124 |
+
|
125 |
+
$reviewForm
|
126 |
+
.on('click', '.submit-review', addReview)
|
127 |
+
.on('click', '.close', function (e) {
|
128 |
+
e.preventDefault();
|
129 |
+
closeForm();
|
130 |
+
})
|
131 |
+
}
|
132 |
+
|
133 |
+
$(document).ready(function () {
|
134 |
+
new CourseReview();
|
135 |
+
});
|
136 |
|
137 |
})
|
138 |
(jQuery);
|
139 |
jQuery(document).ready(function ($) {
|
140 |
|
141 |
+
$(document).on('click', '.course-review-load-more', function () {
|
142 |
+
var $button = $(this);
|
143 |
+
if (!$button.is(':visible')) return;
|
144 |
+
$button.hide();
|
145 |
+
var paged = parseInt($(this).attr('data-paged')) + 1;
|
146 |
+
$('#course-reviews .loading').show();
|
147 |
+
$.ajax({
|
148 |
+
type: "POST",
|
149 |
+
dataType: 'html',
|
150 |
+
url: window.location.href,
|
151 |
+
data: {
|
152 |
+
'lp-ajax': 'learnpress_load_course_review',
|
153 |
+
'paged': paged
|
154 |
+
},
|
155 |
+
success: function (response) {
|
156 |
+
//response = LP.parseJSON(response);
|
157 |
+
var $content = $(response),
|
158 |
+
$loading = $('#course-reviews .loading').hide();
|
159 |
+
if ($content.find('.course-reviews-list').length) {
|
160 |
+
$content.find('.course-reviews-list > li:not(.loading)').insertBefore($loading);
|
161 |
+
}
|
162 |
+
if ($content.find('.course-review-load-more').length) {
|
163 |
+
$button.show().attr('data-paged', paged);
|
164 |
+
} else {
|
165 |
+
$button.remove();
|
166 |
+
}
|
167 |
+
}
|
168 |
+
});
|
169 |
+
});
|
170 |
+
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/functions.php
CHANGED
@@ -6,16 +6,16 @@
|
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Functions
|
9 |
-
* @version 3.0.
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
13 |
defined( 'ABSPATH' ) || exit;
|
14 |
|
15 |
/**
|
16 |
-
* @param int
|
17 |
-
* @param int
|
18 |
-
* @param int
|
19 |
* @param boolean $force
|
20 |
*
|
21 |
* @return mixed
|
@@ -257,7 +257,7 @@ function learn_press_init_courses_review( $posts ) {
|
|
257 |
/**
|
258 |
* Get rating for a course
|
259 |
*
|
260 |
-
* @param int
|
261 |
* @param bool $get_items
|
262 |
*
|
263 |
* @return array
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Functions
|
9 |
+
* @version 3.0.1
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
13 |
defined( 'ABSPATH' ) || exit;
|
14 |
|
15 |
/**
|
16 |
+
* @param int $course_id
|
17 |
+
* @param int $paged
|
18 |
+
* @param int $per_page
|
19 |
* @param boolean $force
|
20 |
*
|
21 |
* @return mixed
|
257 |
/**
|
258 |
* Get rating for a course
|
259 |
*
|
260 |
+
* @param int $course_id
|
261 |
* @param bool $get_items
|
262 |
*
|
263 |
* @return array
|
inc/load.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThimPress
|
6 |
* @package LearnPress/Course-Review/Classes
|
7 |
-
* @version 3.0.
|
8 |
*/
|
9 |
|
10 |
// Prevent loading this file directly
|
@@ -73,11 +73,25 @@ if ( ! function_exists( 'LP_Addon_Course_Review' ) ) {
|
|
73 |
|
74 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) );
|
75 |
LP_Request_Handler::register_ajax( 'add_review', array( $this, 'add_review' ) );
|
|
|
76 |
add_shortcode( 'learnpress', array( $this, 'shortcode_review' ) );
|
77 |
|
78 |
$this->init_comment_table();
|
79 |
}
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
/**
|
82 |
* Print rate.
|
83 |
*/
|
@@ -219,7 +233,8 @@ if ( ! function_exists( 'LP_Addon_Course_Review' ) ) {
|
|
219 |
$atts = shortcode_atts( array(
|
220 |
'course_id' => 0,
|
221 |
'show_rate' => 'yes',
|
222 |
-
'show_review' => 'yes'
|
|
|
223 |
), $atts, 'shortcode_review' );
|
224 |
|
225 |
$course_id = $atts['course_id'];
|
@@ -240,7 +255,7 @@ if ( ! function_exists( 'LP_Addon_Course_Review' ) ) {
|
|
240 |
}
|
241 |
|
242 |
if ( $atts['show_review'] ) {
|
243 |
-
$course_review = learn_press_get_course_review( $course_id );
|
244 |
learn_press_course_review_template( 'shortcode-course-review.php', array(
|
245 |
'course_id' => $course_id,
|
246 |
'course_review' => $course_review
|
4 |
*
|
5 |
* @author ThimPress
|
6 |
* @package LearnPress/Course-Review/Classes
|
7 |
+
* @version 3.0.1
|
8 |
*/
|
9 |
|
10 |
// Prevent loading this file directly
|
73 |
|
74 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) );
|
75 |
LP_Request_Handler::register_ajax( 'add_review', array( $this, 'add_review' ) );
|
76 |
+
LP_Request_Handler::register_ajax( 'learnpress_load_course_review', array( $this, 'learnpress_load_course_review' ) );
|
77 |
add_shortcode( 'learnpress', array( $this, 'shortcode_review' ) );
|
78 |
|
79 |
$this->init_comment_table();
|
80 |
}
|
81 |
|
82 |
+
/**
|
83 |
+
* Get html of reviews
|
84 |
+
*/
|
85 |
+
public function learnpress_load_course_review(){
|
86 |
+
$paged = ! empty( LP_Request::get_post('paged') ) ? intval( LP_Request::get_post('paged') ) : 1;
|
87 |
+
$response = learn_press_get_course_review( get_the_ID(), $paged );
|
88 |
+
if($response['reviews'] && count($response['reviews']) > 0){
|
89 |
+
ob_start();
|
90 |
+
learn_press_course_review_template( 'course-review.php', array( 'review' => $response ) );
|
91 |
+
ob_end_clean();
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
/**
|
96 |
* Print rate.
|
97 |
*/
|
233 |
$atts = shortcode_atts( array(
|
234 |
'course_id' => 0,
|
235 |
'show_rate' => 'yes',
|
236 |
+
'show_review' => 'yes',
|
237 |
+
'display_amount' => '5'
|
238 |
), $atts, 'shortcode_review' );
|
239 |
|
240 |
$course_id = $atts['course_id'];
|
255 |
}
|
256 |
|
257 |
if ( $atts['show_review'] ) {
|
258 |
+
$course_review = learn_press_get_course_review( $course_id, 1 , $atts['display_amount']);
|
259 |
learn_press_course_review_template( 'shortcode-course-review.php', array(
|
260 |
'course_id' => $course_id,
|
261 |
'course_review' => $course_review
|
inc/widgets.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThimPress
|
6 |
* @package LearnPress/Course-Review/Classes
|
7 |
-
* @version 3.0.
|
8 |
*/
|
9 |
|
10 |
// Prevent loading this file directly
|
@@ -32,9 +32,10 @@ class LearnPress_Course_Review_Widget extends WP_Widget {
|
|
32 |
echo $args['before_title'] . $title . $args['after_title'];
|
33 |
}
|
34 |
|
35 |
-
$course_id
|
36 |
-
$show_rate
|
37 |
-
$show_review
|
|
|
38 |
|
39 |
if ( ! $course_id ) {
|
40 |
$course_id = get_the_ID();
|
@@ -52,7 +53,7 @@ class LearnPress_Course_Review_Widget extends WP_Widget {
|
|
52 |
}
|
53 |
|
54 |
if ( $show_review == 'yes' ) {
|
55 |
-
$course_review = learn_press_get_course_review( $course_id );
|
56 |
learn_press_course_review_template( 'shortcode-course-review.php', array(
|
57 |
'course_id' => $course_id,
|
58 |
'course_review' => $course_review
|
@@ -66,17 +67,18 @@ class LearnPress_Course_Review_Widget extends WP_Widget {
|
|
66 |
}
|
67 |
|
68 |
public function form( $instance ) {
|
69 |
-
$arg
|
70 |
'post_type' => 'lp_course',
|
71 |
'posts_per_page' => - 1,
|
72 |
'post_status' => 'publish'
|
73 |
);
|
74 |
-
$the_query
|
75 |
-
$title
|
76 |
-
$course_id
|
77 |
-
$show_rate
|
78 |
-
$show_review
|
79 |
-
$
|
|
|
80 |
if ( $the_query->have_posts() ) {
|
81 |
while ( $the_query->have_posts() ) {
|
82 |
$the_query->the_post();
|
@@ -113,17 +115,24 @@ class LearnPress_Course_Review_Widget extends WP_Widget {
|
|
113 |
<input class="widefat" id="<?php echo $this->get_field_id( 'show_review' ); ?>"
|
114 |
name="<?php echo $this->get_field_name( 'show_review' ); ?>" type="checkbox"
|
115 |
value="yes" <?php checked( $show_review, 'yes', true ); ?> />
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
</p>
|
117 |
<?php
|
118 |
}
|
119 |
|
120 |
// Updating widget replacing old instances with new
|
121 |
public function update( $new_instance, $old_instance ) {
|
122 |
-
$instance
|
123 |
-
$instance['title']
|
124 |
-
$instance['course_id']
|
125 |
-
$instance['show_rate']
|
126 |
-
$instance['show_review']
|
|
|
127 |
|
128 |
return $instance;
|
129 |
}
|
4 |
*
|
5 |
* @author ThimPress
|
6 |
* @package LearnPress/Course-Review/Classes
|
7 |
+
* @version 3.0.1
|
8 |
*/
|
9 |
|
10 |
// Prevent loading this file directly
|
32 |
echo $args['before_title'] . $title . $args['after_title'];
|
33 |
}
|
34 |
|
35 |
+
$course_id = isset( $instance['course_id'] ) ? $instance['course_id'] : 0;
|
36 |
+
$show_rate = isset( $instance['show_rate'] ) ? $instance['show_rate'] : 'no';
|
37 |
+
$show_review = isset( $instance['show_review'] ) ? $instance['show_review'] : 'no';
|
38 |
+
$display_amount = isset( $instance['display_amount'] ) ? $instance['display_amount'] : 5;
|
39 |
|
40 |
if ( ! $course_id ) {
|
41 |
$course_id = get_the_ID();
|
53 |
}
|
54 |
|
55 |
if ( $show_review == 'yes' ) {
|
56 |
+
$course_review = learn_press_get_course_review( $course_id, 1, $display_amount );
|
57 |
learn_press_course_review_template( 'shortcode-course-review.php', array(
|
58 |
'course_id' => $course_id,
|
59 |
'course_review' => $course_review
|
67 |
}
|
68 |
|
69 |
public function form( $instance ) {
|
70 |
+
$arg = array(
|
71 |
'post_type' => 'lp_course',
|
72 |
'posts_per_page' => - 1,
|
73 |
'post_status' => 'publish'
|
74 |
);
|
75 |
+
$the_query = new WP_Query( $arg );
|
76 |
+
$title = isset( $instance['title'] ) ? $instance['title'] : __( 'New title', 'wpb_widget_domain' );
|
77 |
+
$course_id = isset( $instance['course_id'] ) ? $instance['course_id'] : '';
|
78 |
+
$show_rate = isset( $instance['show_rate'] ) ? $instance['show_rate'] : 'no';
|
79 |
+
$show_review = isset( $instance['show_review'] ) ? $instance['show_review'] : 'no';
|
80 |
+
$display_amount = isset( $instance['display_amount'] ) ? $instance['display_amount'] : 5;
|
81 |
+
$option = '';
|
82 |
if ( $the_query->have_posts() ) {
|
83 |
while ( $the_query->have_posts() ) {
|
84 |
$the_query->the_post();
|
115 |
<input class="widefat" id="<?php echo $this->get_field_id( 'show_review' ); ?>"
|
116 |
name="<?php echo $this->get_field_name( 'show_review' ); ?>" type="checkbox"
|
117 |
value="yes" <?php checked( $show_review, 'yes', true ); ?> />
|
118 |
+
</p>
|
119 |
+
<p>
|
120 |
+
<label for="<?php echo $this->get_field_id( 'display_amount' ); ?>"><?php _e( 'Amount Display:', 'learnpress-course-review' ); ?></label>
|
121 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'display_amount' ); ?>"
|
122 |
+
name="<?php echo $this->get_field_name( 'display_amount' ); ?>" type="numeric"
|
123 |
+
value="<?php echo esc_attr( $display_amount ); ?>"/>
|
124 |
</p>
|
125 |
<?php
|
126 |
}
|
127 |
|
128 |
// Updating widget replacing old instances with new
|
129 |
public function update( $new_instance, $old_instance ) {
|
130 |
+
$instance = $old_instance;
|
131 |
+
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
|
132 |
+
$instance['course_id'] = ( ! empty( $new_instance['course_id'] ) ) ? strip_tags( $new_instance['course_id'] ) : '';
|
133 |
+
$instance['show_rate'] = ( ! empty( $new_instance['show_rate'] ) ) ? strip_tags( $new_instance['show_rate'] ) : '';
|
134 |
+
$instance['show_review'] = ( ! empty( $new_instance['show_review'] ) ) ? strip_tags( $new_instance['show_review'] ) : '';
|
135 |
+
$instance['display_amount'] = ( ! empty( $new_instance['display_amount'] ) ) ? strip_tags( $new_instance['display_amount'] ) : 5;
|
136 |
|
137 |
return $instance;
|
138 |
}
|
languages/learnpress-course-review.pot
CHANGED
@@ -18,147 +18,167 @@ msgstr ""
|
|
18 |
"Content-Transfer-Encoding: 8bit\n"
|
19 |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
20 |
|
21 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
msgid "Please enter the review title"
|
23 |
msgstr ""
|
24 |
|
25 |
-
#: inc/load.php:
|
26 |
msgid "Please enter the review content"
|
27 |
msgstr ""
|
28 |
|
29 |
-
#: inc/load.php:
|
30 |
msgid "Please select your rating"
|
31 |
msgstr ""
|
32 |
|
33 |
-
#: inc/load.php:
|
34 |
msgid "Error"
|
35 |
msgstr ""
|
36 |
|
37 |
-
#: inc/load.php:
|
38 |
msgid "Invalid course"
|
39 |
msgstr ""
|
40 |
|
41 |
-
#: inc/load.php:
|
42 |
msgid "Course review"
|
43 |
msgstr ""
|
44 |
|
45 |
-
#: inc/load.php:
|
46 |
msgid "Filter by post type"
|
47 |
msgstr ""
|
48 |
|
49 |
-
#: inc/load.php:
|
50 |
msgid "All post type"
|
51 |
msgstr ""
|
52 |
|
53 |
-
#: inc/load.php:
|
54 |
msgid "Course comments"
|
55 |
msgstr ""
|
56 |
|
57 |
-
#: inc/load.php:
|
58 |
-
#: templates/shortcode-course-review.php:
|
59 |
msgid "Reviews"
|
60 |
msgstr ""
|
61 |
|
62 |
-
#: inc/widgets.php:
|
63 |
msgid "Course Review"
|
64 |
msgstr ""
|
65 |
|
66 |
-
#: inc/widgets.php:
|
67 |
msgid "Display ratings and reviews of course"
|
68 |
msgstr ""
|
69 |
|
70 |
-
#: inc/widgets.php:
|
71 |
msgid "New title"
|
72 |
msgstr ""
|
73 |
|
74 |
-
#: inc/widgets.php:
|
75 |
msgid "Title:"
|
76 |
msgstr ""
|
77 |
|
78 |
-
#: inc/widgets.php:
|
79 |
msgid "Course Id:"
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: inc/widgets.php:
|
83 |
msgid "Show Rate:"
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: inc/widgets.php:
|
87 |
msgid "Show Review:"
|
88 |
msgstr ""
|
89 |
|
90 |
-
#:
|
|
|
|
|
|
|
|
|
91 |
#, php-format
|
92 |
msgid " %1.2f average based on "
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: templates/course-rate.php:
|
96 |
#, php-format
|
97 |
msgid " %d rating"
|
98 |
msgid_plural "%d ratings"
|
99 |
msgstr[0] ""
|
100 |
msgstr[1] ""
|
101 |
|
102 |
-
#: templates/course-rate.php:
|
103 |
msgid " Star"
|
104 |
msgstr ""
|
105 |
|
106 |
-
#: templates/course-review.php:
|
107 |
msgid "Loading..."
|
108 |
msgstr ""
|
109 |
|
110 |
-
#: templates/course-review.php:
|
111 |
-
msgid "
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: templates/
|
115 |
-
|
|
|
116 |
msgstr ""
|
117 |
|
118 |
-
#: templates/review-form.php:
|
119 |
msgid "Write a review"
|
120 |
msgstr ""
|
121 |
|
122 |
-
#: templates/review-form.php:
|
123 |
msgid "Title"
|
124 |
msgstr ""
|
125 |
|
126 |
-
#: templates/review-form.php:
|
127 |
msgid "Content"
|
128 |
msgstr ""
|
129 |
|
130 |
-
#: templates/review-form.php:
|
131 |
msgid "Rating"
|
132 |
msgstr ""
|
133 |
|
134 |
-
#: templates/review-form.php:
|
135 |
msgid "Add review"
|
136 |
msgstr ""
|
137 |
|
138 |
-
#: templates/review-form.php:
|
139 |
msgid "Cancel"
|
140 |
msgstr ""
|
141 |
|
142 |
-
#: templates/
|
143 |
-
msgid "Please wait..."
|
144 |
-
msgstr ""
|
145 |
-
|
146 |
-
#: templates/shortcode-course-rate.php:12
|
147 |
#, php-format
|
148 |
msgid "%d rating"
|
149 |
msgid_plural "%d ratings"
|
150 |
msgstr[0] ""
|
151 |
msgstr[1] ""
|
152 |
|
153 |
-
#: templates/shortcode-course-rate.php:
|
154 |
msgid "Star"
|
155 |
msgstr ""
|
156 |
|
157 |
-
#: templates/shortcode-course-rate.php:
|
158 |
msgid "Rate"
|
159 |
msgstr ""
|
160 |
|
161 |
-
#: templates/shortcode-course-review.php:
|
162 |
#, php-format
|
163 |
msgid "Average rate: <span>%.1f</span>"
|
164 |
msgstr ""
|
|
|
|
|
|
|
|
18 |
"Content-Transfer-Encoding: 8bit\n"
|
19 |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
20 |
|
21 |
+
#: learnpress-course-review.php:52
|
22 |
+
#, php-format
|
23 |
+
msgid ""
|
24 |
+
"<strong>%s</strong> addon version %s requires %s version %s or higher is "
|
25 |
+
"<strong>installed</strong> and <strong>activated</strong>."
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
#: learnpress-course-review.php:53
|
29 |
+
msgid "LearnPress Course Review"
|
30 |
+
msgstr ""
|
31 |
+
|
32 |
+
#: learnpress-course-review.php:55
|
33 |
+
msgid "LearnPress"
|
34 |
+
msgstr ""
|
35 |
+
|
36 |
+
#: inc/load.php:136
|
37 |
msgid "Please enter the review title"
|
38 |
msgstr ""
|
39 |
|
40 |
+
#: inc/load.php:137
|
41 |
msgid "Please enter the review content"
|
42 |
msgstr ""
|
43 |
|
44 |
+
#: inc/load.php:138
|
45 |
msgid "Please select your rating"
|
46 |
msgstr ""
|
47 |
|
48 |
+
#: inc/load.php:164
|
49 |
msgid "Error"
|
50 |
msgstr ""
|
51 |
|
52 |
+
#: inc/load.php:169
|
53 |
msgid "Invalid course"
|
54 |
msgstr ""
|
55 |
|
56 |
+
#: inc/load.php:191
|
57 |
msgid "Course review"
|
58 |
msgstr ""
|
59 |
|
60 |
+
#: inc/load.php:215
|
61 |
msgid "Filter by post type"
|
62 |
msgstr ""
|
63 |
|
64 |
+
#: inc/load.php:219
|
65 |
msgid "All post type"
|
66 |
msgstr ""
|
67 |
|
68 |
+
#: inc/load.php:220
|
69 |
msgid "Course comments"
|
70 |
msgstr ""
|
71 |
|
72 |
+
#: inc/load.php:278 templates/course-review.php:21
|
73 |
+
#: templates/shortcode-course-review.php:21
|
74 |
msgid "Reviews"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: inc/widgets.php:19
|
78 |
msgid "Course Review"
|
79 |
msgstr ""
|
80 |
|
81 |
+
#: inc/widgets.php:20
|
82 |
msgid "Display ratings and reviews of course"
|
83 |
msgstr ""
|
84 |
|
85 |
+
#: inc/widgets.php:76
|
86 |
msgid "New title"
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: inc/widgets.php:96
|
90 |
msgid "Title:"
|
91 |
msgstr ""
|
92 |
|
93 |
+
#: inc/widgets.php:102
|
94 |
msgid "Course Id:"
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: inc/widgets.php:108
|
98 |
msgid "Show Rate:"
|
99 |
msgstr ""
|
100 |
|
101 |
+
#: inc/widgets.php:114
|
102 |
msgid "Show Review:"
|
103 |
msgstr ""
|
104 |
|
105 |
+
#: inc/widgets.php:120
|
106 |
+
msgid "Amount Display:"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
#: templates/course-rate.php:27
|
110 |
#, php-format
|
111 |
msgid " %1.2f average based on "
|
112 |
msgstr ""
|
113 |
|
114 |
+
#: templates/course-rate.php:28
|
115 |
#, php-format
|
116 |
msgid " %d rating"
|
117 |
msgid_plural "%d ratings"
|
118 |
msgstr[0] ""
|
119 |
msgstr[1] ""
|
120 |
|
121 |
+
#: templates/course-rate.php:37
|
122 |
msgid " Star"
|
123 |
msgstr ""
|
124 |
|
125 |
+
#: templates/course-review.php:28
|
126 |
msgid "Loading..."
|
127 |
msgstr ""
|
128 |
|
129 |
+
#: templates/course-review.php:35
|
130 |
+
msgid "Load More"
|
131 |
msgstr ""
|
132 |
|
133 |
+
#: templates/rating-stars.php:17
|
134 |
+
#, php-format
|
135 |
+
msgid "%s out of 5 stars"
|
136 |
msgstr ""
|
137 |
|
138 |
+
#: templates/review-form.php:16 templates/review-form.php:23
|
139 |
msgid "Write a review"
|
140 |
msgstr ""
|
141 |
|
142 |
+
#: templates/review-form.php:29
|
143 |
msgid "Title"
|
144 |
msgstr ""
|
145 |
|
146 |
+
#: templates/review-form.php:33
|
147 |
msgid "Content"
|
148 |
msgstr ""
|
149 |
|
150 |
+
#: templates/review-form.php:37
|
151 |
msgid "Rating"
|
152 |
msgstr ""
|
153 |
|
154 |
+
#: templates/review-form.php:48
|
155 |
msgid "Add review"
|
156 |
msgstr ""
|
157 |
|
158 |
+
#: templates/review-form.php:50
|
159 |
msgid "Cancel"
|
160 |
msgstr ""
|
161 |
|
162 |
+
#: templates/shortcode-course-rate.php:23
|
|
|
|
|
|
|
|
|
163 |
#, php-format
|
164 |
msgid "%d rating"
|
165 |
msgid_plural "%d ratings"
|
166 |
msgstr[0] ""
|
167 |
msgstr[1] ""
|
168 |
|
169 |
+
#: templates/shortcode-course-rate.php:36
|
170 |
msgid "Star"
|
171 |
msgstr ""
|
172 |
|
173 |
+
#: templates/shortcode-course-rate.php:37
|
174 |
msgid "Rate"
|
175 |
msgstr ""
|
176 |
|
177 |
+
#: templates/shortcode-course-review.php:22
|
178 |
#, php-format
|
179 |
msgid "Average rate: <span>%.1f</span>"
|
180 |
msgstr ""
|
181 |
+
|
182 |
+
#: templates/shortcode-course-review.php:31
|
183 |
+
msgid "No review to load"
|
184 |
+
msgstr ""
|
learnpress-course-review.php
CHANGED
@@ -4,11 +4,11 @@ Plugin Name: LearnPress - Course Review
|
|
4 |
Plugin URI: http://thimpress.com/learnpress
|
5 |
Description: Adding review for course.
|
6 |
Author: ThimPress
|
7 |
-
Version: 3.0.
|
8 |
Author URI: http://thimpress.com
|
9 |
Tags: learnpress
|
10 |
Requires at least: 3.8
|
11 |
-
Tested up to: 4.9.
|
12 |
Text Domain: learnpress-course-review
|
13 |
Domain Path: /languages/
|
14 |
*/
|
@@ -17,7 +17,7 @@ Domain Path: /languages/
|
|
17 |
defined( 'ABSPATH' ) || exit;
|
18 |
|
19 |
define( 'LP_ADDON_COURSE_REVIEW_FILE', __FILE__ );
|
20 |
-
define( 'LP_ADDON_COURSE_REVIEW_VER', '3.0.
|
21 |
define( 'LP_ADDON_COURSE_REVIEW_REQUIRE_VER', '3.0.0' );
|
22 |
|
23 |
/**
|
4 |
Plugin URI: http://thimpress.com/learnpress
|
5 |
Description: Adding review for course.
|
6 |
Author: ThimPress
|
7 |
+
Version: 3.0.1
|
8 |
Author URI: http://thimpress.com
|
9 |
Tags: learnpress
|
10 |
Requires at least: 3.8
|
11 |
+
Tested up to: 4.9.5
|
12 |
Text Domain: learnpress-course-review
|
13 |
Domain Path: /languages/
|
14 |
*/
|
17 |
defined( 'ABSPATH' ) || exit;
|
18 |
|
19 |
define( 'LP_ADDON_COURSE_REVIEW_FILE', __FILE__ );
|
20 |
+
define( 'LP_ADDON_COURSE_REVIEW_VER', '3.0.1' );
|
21 |
define( 'LP_ADDON_COURSE_REVIEW_REQUIRE_VER', '3.0.0' );
|
22 |
|
23 |
/**
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: thimpress, tunnhn, kendy73
|
|
3 |
Donate link:
|
4 |
Tags: lms, elearning, e-learning, learning management system, education, course, courses, quiz, quizzes, questions, training, guru, sell courses
|
5 |
Requires at least: 3.8
|
6 |
-
Tested up to: 4.9.
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -56,6 +56,9 @@ Check out <a href="http://docs.thimpress.com/learnpress" target="_blank">LearnPr
|
|
56 |
|
57 |
== Changelog ==
|
58 |
|
|
|
|
|
|
|
59 |
= 3.0.0 =
|
60 |
+ Compatible with Learnpress 3.0.0
|
61 |
|
3 |
Donate link:
|
4 |
Tags: lms, elearning, e-learning, learning management system, education, course, courses, quiz, quizzes, questions, training, guru, sell courses
|
5 |
Requires at least: 3.8
|
6 |
+
Tested up to: 4.9.5
|
7 |
+
Stable tag: 3.0.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
56 |
|
57 |
== Changelog ==
|
58 |
|
59 |
+
= 3.0.1 =
|
60 |
+
+ Fixed bug with AJAX call when load more reviews.
|
61 |
+
|
62 |
= 3.0.0 =
|
63 |
+ Compatible with Learnpress 3.0.0
|
64 |
|
templates/course-rate.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Templates
|
9 |
-
*
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Templates
|
9 |
+
* version 3.0.1
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
templates/course-review.php
CHANGED
@@ -6,14 +6,15 @@
|
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Templates
|
9 |
-
* @version 3.0.
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
13 |
defined( 'ABSPATH' ) || exit;
|
14 |
|
15 |
$course_id = get_the_ID();
|
16 |
-
$
|
|
|
17 |
if ( $course_review['total'] ) {
|
18 |
$reviews = $course_review['reviews']; ?>
|
19 |
<div id="course-reviews">
|
@@ -30,7 +31,7 @@ if ( $course_review['total'] ) {
|
|
30 |
<?php //_e( 'No review to load', 'learnpress-course-review' ); ?>
|
31 |
</ul>
|
32 |
<?php if ( empty( $course_review['finish'] ) ) { ?>
|
33 |
-
<button class="button" id="course-review-load-more"
|
34 |
data-paged="<?php echo $course_review['paged']; ?>"><?php _e( 'Load More', 'learnpress-course-review' ); ?></button>
|
35 |
<?php } ?>
|
36 |
</div>
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Templates
|
9 |
+
* @version 3.0.1
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
13 |
defined( 'ABSPATH' ) || exit;
|
14 |
|
15 |
$course_id = get_the_ID();
|
16 |
+
$paged = ! empty( $_REQUEST['paged'] ) ? intval( $_REQUEST['paged'] ) : 1;
|
17 |
+
$course_review = learn_press_get_course_review( $course_id, $paged );//echo'<pre>';print_r($course_review);die;
|
18 |
if ( $course_review['total'] ) {
|
19 |
$reviews = $course_review['reviews']; ?>
|
20 |
<div id="course-reviews">
|
31 |
<?php //_e( 'No review to load', 'learnpress-course-review' ); ?>
|
32 |
</ul>
|
33 |
<?php if ( empty( $course_review['finish'] ) ) { ?>
|
34 |
+
<button class="button course-review-load-more" id="course-review-load-more"
|
35 |
data-paged="<?php echo $course_review['paged']; ?>"><?php _e( 'Load More', 'learnpress-course-review' ); ?></button>
|
36 |
<?php } ?>
|
37 |
</div>
|
templates/loop-review.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Templates
|
9 |
-
*
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
@@ -14,27 +14,27 @@ defined( 'ABSPATH' ) || exit;
|
|
14 |
?>
|
15 |
|
16 |
<li>
|
17 |
-
|
18 |
<?php echo get_avatar( $review->user_email ) ?>
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
<?php do_action( 'learn_press_before_review_username' ); ?>
|
23 |
<?php echo $review->user_login; ?>
|
24 |
<?php do_action( 'learn_press_after_review_username' ); ?>
|
25 |
-
|
26 |
<?php learn_press_course_review_template( 'rating-stars.php', array( 'rated' => $review->rate ) ); ?>
|
27 |
-
|
28 |
<?php do_action( 'learn_press_before_review_title' ); ?>
|
29 |
<?php echo $review->title ?>
|
30 |
<?php do_action( 'learn_press_after_review_title' ); ?>
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
<?php do_action( 'learn_press_before_review_content' ); ?>
|
36 |
<?php echo $review->content ?>
|
37 |
<?php do_action( 'learn_press_after_review_content' ); ?>
|
38 |
-
|
39 |
-
|
40 |
</li>
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Templates
|
9 |
+
* version 3.0.1
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
14 |
?>
|
15 |
|
16 |
<li>
|
17 |
+
<div class="review-author">
|
18 |
<?php echo get_avatar( $review->user_email ) ?>
|
19 |
+
</div>
|
20 |
+
<div class="review-author-info">
|
21 |
+
<h4 class="user-name">
|
22 |
<?php do_action( 'learn_press_before_review_username' ); ?>
|
23 |
<?php echo $review->user_login; ?>
|
24 |
<?php do_action( 'learn_press_after_review_username' ); ?>
|
25 |
+
</h4>
|
26 |
<?php learn_press_course_review_template( 'rating-stars.php', array( 'rated' => $review->rate ) ); ?>
|
27 |
+
<p class="review-title">
|
28 |
<?php do_action( 'learn_press_before_review_title' ); ?>
|
29 |
<?php echo $review->title ?>
|
30 |
<?php do_action( 'learn_press_after_review_title' ); ?>
|
31 |
+
</p>
|
32 |
+
</div>
|
33 |
+
<div class="review-text">
|
34 |
+
<div class="review-content">
|
35 |
<?php do_action( 'learn_press_before_review_content' ); ?>
|
36 |
<?php echo $review->content ?>
|
37 |
<?php do_action( 'learn_press_after_review_content' ); ?>
|
38 |
+
</div>
|
39 |
+
</div>
|
40 |
</li>
|
templates/rating-stars.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Templates
|
9 |
-
*
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Templates
|
9 |
+
* version 3.0.1
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
templates/review-form.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Templates
|
9 |
-
*
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Templates
|
9 |
+
* version 3.0.1
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
templates/shortcode-course-rate.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Templates
|
9 |
-
*
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Templates
|
9 |
+
* version 3.0.1
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
templates/shortcode-course-review.php
CHANGED
@@ -6,36 +6,27 @@
|
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Templates
|
9 |
-
*
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
13 |
defined( 'ABSPATH' ) || exit;
|
14 |
|
15 |
-
$course_id
|
16 |
-
$course_review = learn_press_get_course_review( $course_id );
|
17 |
if ( $course_review['total'] ) {
|
18 |
$course_rate = learn_press_get_course_rate( $course_id, false );
|
19 |
$reviews = $course_review['reviews'];
|
20 |
?>
|
21 |
-
<div id="course-reviews">
|
22 |
<h3 class="course-review-head"><?php _e( 'Reviews', 'learnpress-course-review' ); ?></h3>
|
23 |
<p class="course-average-rate"><?php printf( __( 'Average rate: <span>%.1f</span>', 'learnpress-course-review' ), $course_rate ); ?></p>
|
24 |
-
<ul class="course-reviews-list">
|
25 |
<?php foreach ( $reviews as $review ) { ?>
|
26 |
<?php learn_press_course_review_template( 'loop-review.php', array( 'review' => $review ) ); ?>
|
27 |
<?php } ?>
|
28 |
-
|
29 |
-
<?php if ( empty( $course_review['finish'] ) ) { ?>
|
30 |
-
<li class="loading"><?php _e( 'Loading...', 'learnpress-course-review' ); ?></li>
|
31 |
-
<?php } ?>
|
32 |
</ul>
|
33 |
-
<?php if ( empty( $course_review['finish'] ) ) { ?>
|
34 |
-
<button class="button" id="course-review-load-more"
|
35 |
-
data-paged="<?php echo $course_review['paged']; ?>"><?php _e( 'Load More', 'learnpress-course-review' ); ?></button>
|
36 |
-
<?php } ?>
|
37 |
</div>
|
38 |
<?php
|
39 |
-
}else{
|
40 |
-
|
41 |
}
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package LearnPress/Course-Review/Templates
|
9 |
+
* version 3.0.1
|
10 |
*/
|
11 |
|
12 |
// Prevent loading this file directly
|
13 |
defined( 'ABSPATH' ) || exit;
|
14 |
|
15 |
+
$course_id = $args['course_id'];
|
|
|
16 |
if ( $course_review['total'] ) {
|
17 |
$course_rate = learn_press_get_course_rate( $course_id, false );
|
18 |
$reviews = $course_review['reviews'];
|
19 |
?>
|
20 |
+
<div id="course-reviews-shortcode">
|
21 |
<h3 class="course-review-head"><?php _e( 'Reviews', 'learnpress-course-review' ); ?></h3>
|
22 |
<p class="course-average-rate"><?php printf( __( 'Average rate: <span>%.1f</span>', 'learnpress-course-review' ), $course_rate ); ?></p>
|
23 |
+
<ul class="course-reviews-list-shortcode">
|
24 |
<?php foreach ( $reviews as $review ) { ?>
|
25 |
<?php learn_press_course_review_template( 'loop-review.php', array( 'review' => $review ) ); ?>
|
26 |
<?php } ?>
|
|
|
|
|
|
|
|
|
27 |
</ul>
|
|
|
|
|
|
|
|
|
28 |
</div>
|
29 |
<?php
|
30 |
+
} else {
|
31 |
+
_e( 'No review to load', 'learnpress-course-review' );
|
32 |
}
|