Tutor LMS – eLearning and online course solution - Version 1.4.8

Version Description

  • 10 December, 2019 =

  • Added: Restrict Content Pro Integration (TutorLMS Pro)

  • Added: Course Details Page elements enable / disable

  • Added: action hook do_action( "tutor_save_course_after", $post_ID, $post);

  • Added: action hook do_action('tutor/course/started', $course_id);

  • Added: action hook do_action('tutor/lesson/created', $lesson_id);

  • Fixed: implode parameter in utils utils()->get_total_quiz_attempts_by_course_ids();

Download this release

Release Info

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

Code changes from version 1.4.7 to 1.4.8

assets/addons/restrict-content-pro/thumbnail.png ADDED
Binary file
classes/Addons.php CHANGED
@@ -22,6 +22,10 @@ class Addons {
22
 
23
  public function tutor_addons_lists_to_show(){
24
  $addons = array(
 
 
 
 
25
  'gradebook' => array(
26
  'name' => __('Gradebook', 'tutor'),
27
  'description' => 'Shows student progress from assignment and quiz',
@@ -42,6 +46,10 @@ class Addons {
42
  'name' => __('Paid Memberships Pro', 'tutor'),
43
  'description' => 'Maximize revenue by selling membership access to all of your courses.',
44
  ),
 
 
 
 
45
  'tutor-assignments' => array(
46
  'name' => __('Tutor Assignments', 'tutor'),
47
  'description' => 'Tutor assignments is a great way to assign tasks to students.',
22
 
23
  public function tutor_addons_lists_to_show(){
24
  $addons = array(
25
+ 'buddypress' => array(
26
+ 'name' => __('BuddyPress', 'tutor-pro'),
27
+ 'description' => 'Discuss about course and share your knowledge with your friends through BuddyPress',
28
+ ),
29
  'gradebook' => array(
30
  'name' => __('Gradebook', 'tutor'),
31
  'description' => 'Shows student progress from assignment and quiz',
46
  'name' => __('Paid Memberships Pro', 'tutor'),
47
  'description' => 'Maximize revenue by selling membership access to all of your courses.',
48
  ),
49
+ 'restrict-content-pro' => array(
50
+ 'name' => __('Restrict Content Pro', 'tutor'),
51
+ 'description' => 'Unlock Course depending on Restrict Content Pro Plugin Permission.',
52
+ ),
53
  'tutor-assignments' => array(
54
  'name' => __('Tutor Assignments', 'tutor'),
55
  'description' => 'Tutor assignments is a great way to assign tasks to students.',
classes/Admin.php CHANGED
@@ -324,7 +324,6 @@ class Admin{
324
  'gzip_enabled' => is_callable( 'gzopen' ),
325
  'mbstring_enabled' => extension_loaded( 'mbstring' ),
326
  );
327
-
328
  }
329
 
330
 
324
  'gzip_enabled' => is_callable( 'gzopen' ),
325
  'mbstring_enabled' => extension_loaded( 'mbstring' ),
326
  );
 
327
  }
328
 
329
 
classes/Course.php CHANGED
@@ -37,14 +37,12 @@ class Course extends Tutor_Base {
37
  /**
38
  * Gutenberg author support
39
  */
40
-
41
  add_filter('wp_insert_post_data', array($this, 'tutor_add_gutenberg_author'), '99', 2);
42
 
43
  /**
44
  * Frontend metabox supports for course builder
45
  * @since v.1.3.4
46
  */
47
-
48
  add_action('tutor/dashboard_course_builder_form_field_after', array($this, 'register_meta_box_in_frontend'));
49
 
50
 
@@ -57,9 +55,21 @@ class Course extends Tutor_Base {
57
  * Add course level to course settings
58
  * @since v.1.4.1
59
  */
60
-
61
  add_action('tutor_course/settings_tab_content/after/general', array($this, 'add_course_level_to_settings'));
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
 
63
  /**
64
  * Registering metabox
65
  */
@@ -75,6 +85,7 @@ class Course extends Tutor_Base {
75
  }
76
  add_meta_box( 'tutor-announcements', __( 'Announcements', 'tutor' ), array($this, 'announcements_metabox'), $coursePostType );
77
  }
 
78
  public function course_meta_box($echo = true){
79
  ob_start();
80
  include tutor()->path.'views/metabox/course-topics.php';
@@ -86,6 +97,7 @@ class Course extends Tutor_Base {
86
  return $content;
87
  }
88
  }
 
89
  public function course_additional_data_meta_box($echo = true){
90
 
91
  ob_start();
@@ -98,6 +110,7 @@ class Course extends Tutor_Base {
98
  return $content;
99
  }
100
  }
 
101
  public function video_metabox($echo = true){
102
  ob_start();
103
  include tutor()->path.'views/metabox/video-metabox.php';
@@ -313,6 +326,8 @@ class Course extends Tutor_Base {
313
  wp_insert_post( $post_arr );
314
  }
315
  }
 
 
316
  }
317
 
318
  /**
@@ -372,7 +387,6 @@ class Course extends Tutor_Base {
372
  *
373
  * Add Lesson column
374
  */
375
-
376
  public function add_column($columns){
377
  $date_col = $columns['date'];
378
  unset($columns['date']);
@@ -676,7 +690,6 @@ class Course extends Tutor_Base {
676
  *
677
  * @since v.1.3.4
678
  */
679
-
680
  public function attach_product_with_course($post_ID, $postData){
681
  $attached_product_id = tutor_utils()->get_course_product_id($post_ID);
682
  $course_price = sanitize_text_field(tutor_utils()->array_get('course_price', $_POST));
@@ -782,6 +795,127 @@ class Course extends Tutor_Base {
782
  include tutor()->path.'views/metabox/course-level-metabox.php';
783
  }
784
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
785
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
786
 
 
 
 
 
 
 
 
 
 
 
 
 
787
  }
37
  /**
38
  * Gutenberg author support
39
  */
 
40
  add_filter('wp_insert_post_data', array($this, 'tutor_add_gutenberg_author'), '99', 2);
41
 
42
  /**
43
  * Frontend metabox supports for course builder
44
  * @since v.1.3.4
45
  */
 
46
  add_action('tutor/dashboard_course_builder_form_field_after', array($this, 'register_meta_box_in_frontend'));
47
 
48
 
55
  * Add course level to course settings
56
  * @since v.1.4.1
57
  */
 
58
  add_action('tutor_course/settings_tab_content/after/general', array($this, 'add_course_level_to_settings'));
59
+
60
+ /**
61
+ * Enable Disable Course Details Page Feature
62
+ * @since v.1.4.8
63
+ */
64
+ $this->course_elements_enable_disable();
65
+
66
+ /**
67
+ * @since v.1.4.8
68
+ * Check if course starting, set meta if starting
69
+ */
70
+ add_action('tutor_lesson_load_before', array($this, 'tutor_lesson_load_before'));
71
  }
72
+
73
  /**
74
  * Registering metabox
75
  */
85
  }
86
  add_meta_box( 'tutor-announcements', __( 'Announcements', 'tutor' ), array($this, 'announcements_metabox'), $coursePostType );
87
  }
88
+
89
  public function course_meta_box($echo = true){
90
  ob_start();
91
  include tutor()->path.'views/metabox/course-topics.php';
97
  return $content;
98
  }
99
  }
100
+
101
  public function course_additional_data_meta_box($echo = true){
102
 
103
  ob_start();
110
  return $content;
111
  }
112
  }
113
+
114
  public function video_metabox($echo = true){
115
  ob_start();
116
  include tutor()->path.'views/metabox/video-metabox.php';
326
  wp_insert_post( $post_arr );
327
  }
328
  }
329
+
330
+ do_action( "tutor_save_course_after", $post_ID, $post);
331
  }
332
 
333
  /**
387
  *
388
  * Add Lesson column
389
  */
 
390
  public function add_column($columns){
391
  $date_col = $columns['date'];
392
  unset($columns['date']);
690
  *
691
  * @since v.1.3.4
692
  */
 
693
  public function attach_product_with_course($post_ID, $postData){
694
  $attached_product_id = tutor_utils()->get_course_product_id($post_ID);
695
  $course_price = sanitize_text_field(tutor_utils()->array_get('course_price', $_POST));
795
  include tutor()->path.'views/metabox/course-level-metabox.php';
796
  }
797
 
798
+ /**
799
+ * Check if course starting
800
+ *
801
+ * @since v.1.4.8
802
+ */
803
+ public function tutor_lesson_load_before(){
804
+ $course_id = tutils()->get_course_id_by_content(get_the_ID());
805
+ $completed_lessons = tutor_utils()->get_completed_lesson_count_by_course($course_id);
806
+ if (is_user_logged_in()){
807
+ $is_course_started = get_post_meta($course_id, '_tutor_course_started', true);
808
+ if ( ! $completed_lessons && ! $is_course_started){
809
+ update_post_meta($course_id, '_tutor_course_started', tutor_time());
810
+ do_action('tutor/course/started', $course_id);
811
+ }
812
+ }
813
+ }
814
+
815
+ /**
816
+ * Add Course level to course settings
817
+ * @since v.1.4.8
818
+ */
819
+ public function course_elements_enable_disable(){
820
+ add_filter('tutor_course/single/completing-progress-bar', array($this, 'enable_disable_course_progress_bar') );
821
+ add_filter('tutor_course/single/material_includes', array($this, 'enable_disable_material_includes') );
822
+ add_filter('tutor_course/single/content', array($this, 'enable_disable_course_content') );
823
+ add_filter('tutor_course/single/benefits_html', array($this, 'enable_disable_course_benefits') );
824
+ add_filter('tutor_course/single/requirements_html', array($this, 'enable_disable_course_requirements') );
825
+ add_filter('tutor_course/single/audience_html', array($this, 'enable_disable_course_target_audience') );
826
+ add_filter('tutor_course/single/enrolled/nav_items', array($this, 'enable_disable_course_nav_items') );
827
+ }
828
+
829
+ /**
830
+ * Enable disable course progress bar
831
+ * @since v.1.4.8
832
+ */
833
+ public function enable_disable_course_progress_bar($html){
834
+ $disable_option = (bool) get_tutor_option('disable_course_progress_bar');
835
+ if($disable_option){
836
+ return '';
837
+ }
838
+ return $html;
839
+ }
840
+
841
+ /**
842
+ * Enable disable material includes
843
+ * @since v.1.4.8
844
+ */
845
+ public function enable_disable_material_includes($html){
846
+ $disable_option = (bool) get_tutor_option('disable_course_material');
847
+ if($disable_option){
848
+ return '';
849
+ }
850
+ return $html;
851
+ }
852
+
853
+ /**
854
+ * Enable disable course content
855
+ * @since v.1.4.8
856
+ */
857
+ public function enable_disable_course_content($html){
858
+ $disable_option = (bool) get_tutor_option('disable_course_description');
859
+ if($disable_option){
860
+ return '';
861
+ }
862
+ return $html;
863
+ }
864
+
865
+ /**
866
+ * Enable disable course benefits
867
+ * @since v.1.4.8
868
+ */
869
+ public function enable_disable_course_benefits($html){
870
+ $disable_option = (bool) get_tutor_option('disable_course_benefits');
871
+ if($disable_option){
872
+ return '';
873
+ }
874
+ return $html;
875
+ }
876
+
877
+ /**
878
+ * Enable disable course requirements
879
+ * @since v.1.4.8
880
+ */
881
+ public function enable_disable_course_requirements($html){
882
+ $disable_option = (bool) get_tutor_option('disable_course_requirements');
883
+ if($disable_option){
884
+ return '';
885
+ }
886
+ return $html;
887
+ }
888
 
889
+ /**
890
+ * Enable disable course target audience
891
+ * @since v.1.4.8
892
+ */
893
+ public function enable_disable_course_target_audience($html){
894
+ $disable_option = (bool) get_tutor_option('disable_course_target_audience');
895
+ if($disable_option){
896
+ return '';
897
+ }
898
+ return $html;
899
+ }
900
+
901
+ /**
902
+ * Enable disable course nav items
903
+ * @since v.1.4.8
904
+ */
905
+ public function enable_disable_course_nav_items($items){
906
+ $enable_q_and_a_on_course = (bool) get_tutor_option('enable_q_and_a_on_course');
907
+ $disable_course_announcements = (bool) get_tutor_option('disable_course_announcements');
908
 
909
+ if(! $enable_q_and_a_on_course){
910
+ if(tutils()->array_get('questions', $items)) {
911
+ unset($items['questions']);
912
+ }
913
+ }
914
+ if($disable_course_announcements){
915
+ if(tutils()->array_get('announcements', $items)) {
916
+ unset($items['announcements']);
917
+ }
918
+ }
919
+ return $items;
920
+ }
921
  }
classes/Lesson.php CHANGED
@@ -106,6 +106,7 @@ class Lesson extends Tutor_Base {
106
  );
107
  $lesson_id = wp_insert_post( $post_arr );
108
  if ($lesson_id ) {
 
109
  update_post_meta( $lesson_id, '_tutor_course_id_for_lesson', $course_id );
110
  }
111
  }
106
  );
107
  $lesson_id = wp_insert_post( $post_arr );
108
  if ($lesson_id ) {
109
+ do_action('tutor/lesson/created', $lesson_id);
110
  update_post_meta( $lesson_id, '_tutor_course_id_for_lesson', $course_id );
111
  }
112
  }
classes/Options.php CHANGED
@@ -173,26 +173,6 @@ class Options {
173
  'label_title' => __('Enable', 'tutor'),
174
  'desc' => __('Use Gutenberg editor on course description area.', 'tutor'),
175
  ),
176
- 'display_course_instructors' => array(
177
- 'type' => 'checkbox',
178
- 'label' => __('Display Instructor Info', 'tutor'),
179
- 'label_title' => __('Enable', 'tutor'),
180
- 'desc' => __('Show instructor bio on each page', 'tutor'),
181
- ),
182
- 'enable_q_and_a_on_course' => array(
183
- 'type' => 'checkbox',
184
- 'label' => __('Question and Answer', 'tutor'),
185
- 'label_title' => __('Enable','tutor'),
186
- 'default' => '0',
187
- 'desc' => __('Enabling this feature will add a Q&A section on every course.', 'tutor'),
188
- ),
189
- 'disable_course_review' => array(
190
- 'type' => 'checkbox',
191
- 'label' => __('Course review', 'tutor'),
192
- 'label_title' => __('Disable','tutor'),
193
- 'default' => '0',
194
- 'desc' => __('Disabling this feature will be removed course review system from the course page.', 'tutor'),
195
- ),
196
  ),
197
  ),
198
  'archive' => array(
@@ -208,7 +188,7 @@ class Options {
208
  ),
209
  'courses_col_per_row' => array(
210
  'type' => 'slider',
211
- 'label' => __('Column per row', 'tutor'),
212
  'default' => '4',
213
  'options' => array('min'=> 1, 'max' => 6),
214
  'desc' => __('Define how many column you want to use to display courses.', 'tutor'),
@@ -222,6 +202,130 @@ class Options {
222
  ),
223
  ),
224
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  ),
226
  ),
227
  'lesson' => array(
173
  'label_title' => __('Enable', 'tutor'),
174
  'desc' => __('Use Gutenberg editor on course description area.', 'tutor'),
175
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  ),
177
  ),
178
  'archive' => array(
188
  ),
189
  'courses_col_per_row' => array(
190
  'type' => 'slider',
191
+ 'label' => __('Column Per Row', 'tutor'),
192
  'default' => '4',
193
  'options' => array('min'=> 1, 'max' => 6),
194
  'desc' => __('Define how many column you want to use to display courses.', 'tutor'),
202
  ),
203
  ),
204
  ),
205
+ 'enable_disable' => array(
206
+ 'label' => __('Enable / Disable', 'tutor'),
207
+ 'desc' => __('Course Display Settings', 'tutor'),
208
+ 'fields' => array(
209
+ 'display_course_instructors' => array(
210
+ 'type' => 'checkbox',
211
+ 'label' => __('Display Instructor Info', 'tutor'),
212
+ 'label_title' => __('Enable', 'tutor'),
213
+ 'desc' => __('Show instructor bio on each page', 'tutor'),
214
+ ),
215
+ 'enable_q_and_a_on_course' => array(
216
+ 'type' => 'checkbox',
217
+ 'label' => __('Question and Answer', 'tutor'),
218
+ 'label_title' => __('Enable','tutor'),
219
+ 'default' => '0',
220
+ 'desc' => __('Enabling this feature will add a Q&A section on every course.', 'tutor'),
221
+ ),
222
+ 'disable_course_author' => array(
223
+ 'type' => 'checkbox',
224
+ 'label' => __('Course Author', 'tutor'),
225
+ 'label_title' => __('Disable','tutor'),
226
+ 'default' => '0',
227
+ 'desc' => __('Disabling this feature will be removed course author name from the course page.', 'tutor'),
228
+ ),
229
+ 'disable_course_level' => array(
230
+ 'type' => 'checkbox',
231
+ 'label' => __('Course Level', 'tutor'),
232
+ 'label_title' => __('Disable','tutor'),
233
+ 'default' => '0',
234
+ 'desc' => __('Disabling this feature will be removed course level from the course page.', 'tutor'),
235
+ ),
236
+ 'disable_course_share' => array(
237
+ 'type' => 'checkbox',
238
+ 'label' => __('Course Share', 'tutor'),
239
+ 'label_title' => __('Disable','tutor'),
240
+ 'default' => '0',
241
+ 'desc' => __('Disabling this feature will be removed course share option from the course page.', 'tutor'),
242
+ ),
243
+ 'disable_course_duration' => array(
244
+ 'type' => 'checkbox',
245
+ 'label' => __('Course Duration', 'tutor'),
246
+ 'label_title' => __('Disable','tutor'),
247
+ 'default' => '0',
248
+ 'desc' => __('Disabling this feature will be removed course duration from the course page.', 'tutor'),
249
+ ),
250
+ 'disable_course_total_enrolled' => array(
251
+ 'type' => 'checkbox',
252
+ 'label' => __('Course Total Enrolled', 'tutor'),
253
+ 'label_title' => __('Disable','tutor'),
254
+ 'default' => '0',
255
+ 'desc' => __('Disabling this feature will be removed course total enrolled from the course page.', 'tutor'),
256
+ ),
257
+ 'disable_course_update_date' => array(
258
+ 'type' => 'checkbox',
259
+ 'label' => __('Course Update Date', 'tutor'),
260
+ 'label_title' => __('Disable','tutor'),
261
+ 'default' => '0',
262
+ 'desc' => __('Disabling this feature will be removed course update date from the course page.', 'tutor'),
263
+ ),
264
+ 'disable_course_progress_bar' => array(
265
+ 'type' => 'checkbox',
266
+ 'label' => __('Course Progress Bar', 'tutor'),
267
+ 'label_title' => __('Disable','tutor'),
268
+ 'default' => '0',
269
+ 'desc' => __('Disabling this feature will be removed completing progress bar from the course page.', 'tutor'),
270
+ ),
271
+ 'disable_course_material' => array(
272
+ 'type' => 'checkbox',
273
+ 'label' => __('Course Material', 'tutor'),
274
+ 'label_title' => __('Disable','tutor'),
275
+ 'default' => '0',
276
+ 'desc' => __('Disabling this feature will be removed course material from the course page.', 'tutor'),
277
+ ),
278
+ 'disable_course_about' => array(
279
+ 'type' => 'checkbox',
280
+ 'label' => __('Course About', 'tutor'),
281
+ 'label_title' => __('Disable','tutor'),
282
+ 'default' => '0',
283
+ 'desc' => __('Disabling this feature will be removed course about from the course page.', 'tutor'),
284
+ ),
285
+ 'disable_course_description' => array(
286
+ 'type' => 'checkbox',
287
+ 'label' => __('Course Description', 'tutor'),
288
+ 'label_title' => __('Disable','tutor'),
289
+ 'default' => '0',
290
+ 'desc' => __('Disabling this feature will be removed course description from the course page.', 'tutor'),
291
+ ),
292
+ 'disable_course_benefits' => array(
293
+ 'type' => 'checkbox',
294
+ 'label' => __('Course Benefits', 'tutor'),
295
+ 'label_title' => __('Disable','tutor'),
296
+ 'default' => '0',
297
+ 'desc' => __('Disabling this feature will be removed course benefits from the course page.', 'tutor'),
298
+ ),
299
+ 'disable_course_requirements' => array(
300
+ 'type' => 'checkbox',
301
+ 'label' => __('Course Requirements', 'tutor'),
302
+ 'label_title' => __('Disable','tutor'),
303
+ 'default' => '0',
304
+ 'desc' => __('Disabling this feature will be removed course requirements from the course page.', 'tutor'),
305
+ ),
306
+ 'disable_course_target_audience' => array(
307
+ 'type' => 'checkbox',
308
+ 'label' => __('Course Target Audience', 'tutor'),
309
+ 'label_title' => __('Disable','tutor'),
310
+ 'default' => '0',
311
+ 'desc' => __('Disabling this feature will be removed course target audience from the course page.', 'tutor'),
312
+ ),
313
+ 'disable_course_announcements' => array(
314
+ 'type' => 'checkbox',
315
+ 'label' => __('Course Announcements', 'tutor'),
316
+ 'label_title' => __('Disable','tutor'),
317
+ 'default' => '0',
318
+ 'desc' => __('Disabling this feature will be removed course announcements from the course page.', 'tutor'),
319
+ ),
320
+ 'disable_course_review' => array(
321
+ 'type' => 'checkbox',
322
+ 'label' => __('Course Review', 'tutor'),
323
+ 'label_title' => __('Disable','tutor'),
324
+ 'default' => '0',
325
+ 'desc' => __('Disabling this feature will be removed course review system from the course page.', 'tutor'),
326
+ ),
327
+ ),
328
+ ),
329
  ),
330
  ),
331
  'lesson' => array(
classes/Utils.php CHANGED
@@ -243,6 +243,20 @@ class Utils {
243
  return count(array_intersect($depends, $activated_plugins)) == count($depends);
244
  }
245
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  /**
247
  * @return mixed
248
  *
@@ -973,8 +987,9 @@ class Utils {
973
  public function is_course_enrolled_by_lesson($lesson_id = 0, $user_id = 0){
974
  $lesson_id = $this->get_post_id($lesson_id);
975
  $user_id = $this->get_user_id($user_id);
 
976
 
977
- return $this->is_enrolled($this->get_course_id_by_lesson($lesson_id));
978
  }
979
 
980
  /**
@@ -985,10 +1000,23 @@ class Utils {
985
  * Get the course ID by Lesson
986
  *
987
  * @since v.1.0.0
 
 
 
988
  */
 
989
  public function get_course_id_by_lesson($lesson_id = 0){
990
  $lesson_id = $this->get_post_id($lesson_id);
991
- return get_post_meta($lesson_id, '_tutor_course_id_for_lesson', true);
 
 
 
 
 
 
 
 
 
992
  }
993
 
994
  /**
@@ -1003,7 +1031,8 @@ class Utils {
1003
  public function get_course_first_lesson($course_id = 0){
1004
  $course_id = $this->get_post_id($course_id);
1005
  global $wpdb;
1006
- /*
 
1007
  $lesson_id = $wpdb->get_var("
1008
  SELECT post_id as lesson_id
1009
  FROM $wpdb->postmeta
@@ -1058,14 +1087,9 @@ class Utils {
1058
  public function course_sub_pages(){
1059
  $nav_items = array(
1060
  'overview' => __('Overview', 'tutor'),
 
 
1061
  );
1062
-
1063
- $enable_q_and_a_on_course = tutor_utils()->get_option('enable_q_and_a_on_course');
1064
- if ($enable_q_and_a_on_course){
1065
- $nav_items['questions'] = __('Q&A', 'tutor');
1066
- }
1067
- $nav_items['announcements'] = __('Announcements', 'tutor');
1068
-
1069
  return apply_filters('tutor_course/single/enrolled/nav_items', $nav_items);
1070
  }
1071
 
@@ -3663,7 +3687,7 @@ class Utils {
3663
  $search_term = " AND ( user_email like '%{$search_term}%' OR display_name like '%{$search_term}%' OR post_title like '%{$search_term}%' ) ";
3664
  }
3665
 
3666
- $course_ids_in = implode($course_ids, ',');
3667
  $sql = " AND quiz_attempts.course_id IN({$course_ids_in}) ";
3668
  $search_term = $sql.$search_term;
3669
 
@@ -3686,7 +3710,7 @@ class Utils {
3686
  $search_term = " AND ( user_email like '%{$search_term}%' OR display_name like '%{$search_term}%' OR post_title like '%{$search_term}%' ) ";
3687
  }
3688
 
3689
- $course_ids_in = implode($course_ids, ',');
3690
  $sql = " AND quiz_attempts.course_id IN({$course_ids_in}) ";
3691
  $search_term = $sql.$search_term;
3692
 
243
  return count(array_intersect($depends, $activated_plugins)) == count($depends);
244
  }
245
 
246
+
247
+ /**
248
+ * @return bool
249
+ *
250
+ * checking if BuddyPress exists and activated;
251
+ *
252
+ * @since v.1.4.8
253
+ */
254
+ public function has_bp(){
255
+ $activated_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ));
256
+ $depends = array('buddypress/bp-loader.php');
257
+ return count(array_intersect($depends, $activated_plugins)) == count($depends);
258
+ }
259
+
260
  /**
261
  * @return mixed
262
  *
987
  public function is_course_enrolled_by_lesson($lesson_id = 0, $user_id = 0){
988
  $lesson_id = $this->get_post_id($lesson_id);
989
  $user_id = $this->get_user_id($user_id);
990
+ $course_id = $this->get_course_id_by_lesson($lesson_id);
991
 
992
+ return $this->is_enrolled($course_id);
993
  }
994
 
995
  /**
1000
  * Get the course ID by Lesson
1001
  *
1002
  * @since v.1.0.0
1003
+ *
1004
+ * @updated v.1.4.8
1005
+ * Added Legacy Supports
1006
  */
1007
+
1008
  public function get_course_id_by_lesson($lesson_id = 0){
1009
  $lesson_id = $this->get_post_id($lesson_id);
1010
+ $course_id = get_post_meta($lesson_id, '_tutor_course_id_for_lesson', true);
1011
+
1012
+ if ( ! $course_id) {
1013
+ $course_id = $this->get_course_id_by_content($lesson_id);
1014
+ }
1015
+ if ( ! $course_id){
1016
+ $course_id = 0;
1017
+ }
1018
+
1019
+ return $course_id;
1020
  }
1021
 
1022
  /**
1031
  public function get_course_first_lesson($course_id = 0){
1032
  $course_id = $this->get_post_id($course_id);
1033
  global $wpdb;
1034
+
1035
+ /*
1036
  $lesson_id = $wpdb->get_var("
1037
  SELECT post_id as lesson_id
1038
  FROM $wpdb->postmeta
1087
  public function course_sub_pages(){
1088
  $nav_items = array(
1089
  'overview' => __('Overview', 'tutor'),
1090
+ 'questions' => __('Q&A', 'tutor'),
1091
+ 'announcements' => __('Announcements', 'tutor'),
1092
  );
 
 
 
 
 
 
 
1093
  return apply_filters('tutor_course/single/enrolled/nav_items', $nav_items);
1094
  }
1095
 
3687
  $search_term = " AND ( user_email like '%{$search_term}%' OR display_name like '%{$search_term}%' OR post_title like '%{$search_term}%' ) ";
3688
  }
3689
 
3690
+ $course_ids_in = implode(',', $course_ids);
3691
  $sql = " AND quiz_attempts.course_id IN({$course_ids_in}) ";
3692
  $search_term = $sql.$search_term;
3693
 
3710
  $search_term = " AND ( user_email like '%{$search_term}%' OR display_name like '%{$search_term}%' OR post_title like '%{$search_term}%' ) ";
3711
  }
3712
 
3713
+ $course_ids_in = implode(',', $course_ids);
3714
  $sql = " AND quiz_attempts.course_id IN({$course_ids_in}) ";
3715
  $search_term = $sql.$search_term;
3716
 
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.3
7
  Requires PHP: 5.4.0
8
- Stable tag: 1.4.7
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -241,6 +241,15 @@ Tutor enables you to use any third party plugins without facing any compatibilit
241
 
242
  == Changelog ==
243
 
 
 
 
 
 
 
 
 
 
244
  = 1.4.7 - 28 November, 2019 =
245
 
246
  * Added: Next Previous Lesson|quiz|assignments
5
  Requires at least: 4.5
6
  Tested up to: 5.3
7
  Requires PHP: 5.4.0
8
+ Stable tag: 1.4.8
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
241
 
242
  == Changelog ==
243
 
244
+ = 1.4.8 - 10 December, 2019 =
245
+
246
+ * Added: Restrict Content Pro Integration (TutorLMS Pro)
247
+ * Added: Course Details Page elements enable / disable
248
+ * Added: action hook `do_action( "tutor_save_course_after", $post_ID, $post);`
249
+ * Added: action hook `do_action('tutor/course/started', $course_id);`
250
+ * Added: action hook `do_action('tutor/lesson/created', $lesson_id);`
251
+ * Fixed: implode parameter in utils `utils()->get_total_quiz_attempts_by_course_ids()`;
252
+
253
  = 1.4.7 - 28 November, 2019 =
254
 
255
  * Added: Next Previous Lesson|quiz|assignments
templates/global/login.php CHANGED
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) )
22
  <?php
23
  $current_url = tutils()->get_current_url();
24
  $register_page = tutor_utils()->student_register_url();
25
- $register_url = add_query_arg ('redirect_to', $current_url, $register_page) ;
26
 
27
  //redirect_to
28
  $args = array(
22
  <?php
23
  $current_url = tutils()->get_current_url();
24
  $register_page = tutor_utils()->student_register_url();
25
+ $register_url = add_query_arg ('redirect_to', $current_url, $register_page);
26
 
27
  //redirect_to
28
  $args = array(
templates/single/course/enrolled/lead-info.php CHANGED
@@ -47,26 +47,37 @@ $profile_url = tutor_utils()->profile_url($authordata->ID);
47
  <?php do_action('tutor_course/single/lead_meta/before'); ?>
48
 
49
  <div class="tutor-single-course-meta tutor-meta-top">
 
 
 
 
 
50
  <ul>
51
- <li class="tutor-single-course-author-meta">
52
- <div class="tutor-single-course-avatar">
53
- <a href="<?php echo $profile_url; ?>"> <?php echo tutor_utils()->get_tutor_avatar($post->post_author); ?></a>
54
- </div>
55
- <div class="tutor-single-course-author-name">
56
- <span><?php _e('by', 'tutor'); ?></span>
57
- <a href="<?php echo tutor_utils()->profile_url($authordata->ID); ?>"><?php echo get_the_author(); ?></a>
58
- </div>
59
- </li>
60
- <li class="tutor-course-level">
61
- <span><?php _e('Course level:', 'tutor'); ?></span>
62
- <?php echo get_tutor_course_level(); ?>
63
- </li>
64
-
65
- <li class="tutor-social-share">
66
- <span><?php _e('Share:', 'tutor'); ?></span>
67
- <?php tutor_social_share(); ?>
68
- </li>
69
 
 
 
 
 
 
 
70
  </ul>
71
 
72
  </div>
@@ -91,22 +102,31 @@ $profile_url = tutor_utils()->profile_url($authordata->ID);
91
  <?php } ?>
92
 
93
  <?php
94
- $course_duration = get_tutor_course_duration_context();
95
- if(!empty($course_duration)){
96
- ?>
 
 
 
97
  <li>
98
- <span><?php esc_html_e('Total Hour', 'tutor') ?></span>
99
- <?php echo $course_duration; ?>
100
  </li>
101
- <?php } ?>
102
- <li>
103
- <span><?php esc_html_e('Total Enrolled', 'tutor') ?></span>
104
- <?php echo (int) tutor_utils()->count_enrolled_users_by_course(); ?>
105
- </li>
106
- <li>
107
- <span><?php esc_html_e('Last Update', 'tutor') ?></span>
108
- <?php echo esc_html(get_the_modified_date()); ?>
109
- </li>
 
 
 
 
 
 
110
  </ul>
111
  </div>
112
 
@@ -131,8 +151,9 @@ $profile_url = tutor_utils()->profile_url($authordata->ID);
131
  <?php do_action('tutor_course/single/excerpt/before'); ?>
132
 
133
  <?php
134
- $excerpt = tutor_get_the_excerpt();
135
- if (! empty($excerpt)){
 
136
  ?>
137
  <div class="tutor-course-summery">
138
  <h4 class="tutor-segment-title"><?php esc_html_e('About Course', 'tutor') ?></h4>
47
  <?php do_action('tutor_course/single/lead_meta/before'); ?>
48
 
49
  <div class="tutor-single-course-meta tutor-meta-top">
50
+ <?php
51
+ $disable_course_author = get_tutor_option('disable_course_author');
52
+ $disable_course_level = get_tutor_option('disable_course_level');
53
+ $disable_course_share = get_tutor_option('disable_course_share');
54
+ ?>
55
  <ul>
56
+ <?php if ( !$disable_course_author){ ?>
57
+ <li class="tutor-single-course-author-meta">
58
+ <div class="tutor-single-course-avatar">
59
+ <a href="<?php echo $profile_url; ?>"> <?php echo tutor_utils()->get_tutor_avatar($post->post_author); ?></a>
60
+ </div>
61
+ <div class="tutor-single-course-author-name">
62
+ <span><?php _e('by', 'tutor'); ?></span>
63
+ <a href="<?php echo tutor_utils()->profile_url($authordata->ID); ?>"><?php echo get_the_author(); ?></a>
64
+ </div>
65
+ </li>
66
+ <?php } ?>
67
+
68
+ <?php if ( !$disable_course_level){ ?>
69
+ <li class="tutor-course-level">
70
+ <span><?php _e('Course level:', 'tutor'); ?></span>
71
+ <?php echo get_tutor_course_level(); ?>
72
+ </li>
73
+ <?php } ?>
74
 
75
+ <?php if ( !$disable_course_share){ ?>
76
+ <li class="tutor-social-share">
77
+ <span><?php _e('Share:', 'tutor'); ?></span>
78
+ <?php tutor_social_share(); ?>
79
+ </li>
80
+ <?php } ?>
81
  </ul>
82
 
83
  </div>
102
  <?php } ?>
103
 
104
  <?php
105
+ $disable_course_duration = get_tutor_option('disable_course_duration');
106
+ $disable_total_enrolled = get_tutor_option('disable_course_total_enrolled');
107
+ $disable_update_date = get_tutor_option('disable_course_update_date');
108
+ $course_duration = get_tutor_course_duration_context();
109
+
110
+ if( !empty($course_duration) && !$disable_course_duration){ ?>
111
  <li>
112
+ <span><?php esc_html_e('Duration', 'tutor') ?></span>
113
+ <?php echo $course_duration; ?>
114
  </li>
115
+ <?php }
116
+
117
+ if( !$disable_total_enrolled){ ?>
118
+ <li>
119
+ <span><?php esc_html_e('Total Enrolled', 'tutor') ?></span>
120
+ <?php echo (int) tutor_utils()->count_enrolled_users_by_course(); ?>
121
+ </li>
122
+ <?php }
123
+
124
+ if( !$disable_update_date){ ?>
125
+ <li>
126
+ <span><?php esc_html_e('Last Update', 'tutor') ?></span>
127
+ <?php echo esc_html(get_the_modified_date()); ?>
128
+ </li>
129
+ <?php } ?>
130
  </ul>
131
  </div>
132
 
151
  <?php do_action('tutor_course/single/excerpt/before'); ?>
152
 
153
  <?php
154
+ $excerpt = tutor_get_the_excerpt();
155
+ $disable_about = get_tutor_option('disable_course_about');
156
+ if (! empty($excerpt) && ! $disable_about){
157
  ?>
158
  <div class="tutor-course-summery">
159
  <h4 class="tutor-segment-title"><?php esc_html_e('About Course', 'tutor') ?></h4>
templates/single/course/lead-info.php CHANGED
@@ -47,25 +47,37 @@ $profile_url = tutor_utils()->profile_url($authordata->ID);
47
  <?php do_action('tutor_course/single/lead_meta/before'); ?>
48
 
49
  <div class="tutor-single-course-meta tutor-meta-top">
 
 
 
 
 
50
  <ul>
51
- <li class="tutor-single-course-author-meta">
52
- <div class="tutor-single-course-avatar">
53
- <a href="<?php echo $profile_url; ?>"> <?php echo tutor_utils()->get_tutor_avatar($post->post_author); ?></a>
54
- </div>
55
- <div class="tutor-single-course-author-name">
56
- <span><?php _e('by', 'tutor'); ?></span>
57
- <a href="<?php echo tutor_utils()->profile_url($authordata->ID); ?>"><?php echo get_the_author(); ?></a>
58
- </div>
59
- </li>
60
- <li class="tutor-course-level">
61
- <strong><?php _e('Course level:', 'tutor'); ?></strong>
62
- <?php echo get_tutor_course_level(); ?>
63
- </li>
64
-
65
- <li class="tutor-social-share">
66
- <span><?php _e('Share:', 'tutor'); ?></span>
67
- <?php tutor_social_share(); ?>
68
- </li>
 
 
 
 
 
 
 
69
  </ul>
70
 
71
  </div>
@@ -88,23 +100,32 @@ $profile_url = tutor_utils()->profile_url($authordata->ID);
88
  </li>
89
  <?php } ?>
90
 
91
- <?php
92
- $course_duration = get_tutor_course_duration_context();
93
- if(!empty($course_duration)){
94
- ?>
 
 
 
95
  <li>
96
- <span><?php esc_html_e('Total Hour', 'tutor') ?></span>
97
  <?php echo $course_duration; ?>
98
  </li>
99
- <?php } ?>
100
- <li>
101
- <span><?php esc_html_e('Total Enrolled', 'tutor') ?></span>
102
- <?php echo (int) tutor_utils()->count_enrolled_users_by_course(); ?>
103
- </li>
104
- <li>
105
- <span><?php esc_html_e('Last Update', 'tutor') ?></span>
106
- <?php echo esc_html(get_the_modified_date()); ?>
107
- </li>
 
 
 
 
 
 
108
  </ul>
109
  </div>
110
 
@@ -113,8 +134,8 @@ $profile_url = tutor_utils()->profile_url($authordata->ID);
113
 
114
  <?php
115
  $excerpt = tutor_get_the_excerpt();
116
-
117
- if (! empty($excerpt)){
118
  ?>
119
  <div class="tutor-course-summery">
120
  <h4 class="tutor-segment-title"><?php esc_html_e('About Course', 'tutor') ?></h4>
47
  <?php do_action('tutor_course/single/lead_meta/before'); ?>
48
 
49
  <div class="tutor-single-course-meta tutor-meta-top">
50
+ <?php
51
+ $disable_course_author = get_tutor_option('disable_course_author');
52
+ $disable_course_level = get_tutor_option('disable_course_level');
53
+ $disable_course_share = get_tutor_option('disable_course_share');
54
+ ?>
55
  <ul>
56
+ <?php if ( !$disable_course_author){ ?>
57
+ <li class="tutor-single-course-author-meta">
58
+ <div class="tutor-single-course-avatar">
59
+ <a href="<?php echo $profile_url; ?>"> <?php echo tutor_utils()->get_tutor_avatar($post->post_author); ?></a>
60
+ </div>
61
+ <div class="tutor-single-course-author-name">
62
+ <span><?php _e('by', 'tutor'); ?></span>
63
+ <a href="<?php echo tutor_utils()->profile_url($authordata->ID); ?>"><?php echo get_the_author(); ?></a>
64
+ </div>
65
+ </li>
66
+ <?php } ?>
67
+
68
+ <?php if ( !$disable_course_level){ ?>
69
+ <li class="tutor-course-level">
70
+ <strong><?php _e('Course level:', 'tutor'); ?></strong>
71
+ <?php echo get_tutor_course_level(); ?>
72
+ </li>
73
+ <?php } ?>
74
+
75
+ <?php if ( !$disable_course_share){ ?>
76
+ <li class="tutor-social-share">
77
+ <span><?php _e('Share:', 'tutor'); ?></span>
78
+ <?php tutor_social_share(); ?>
79
+ </li>
80
+ <?php } ?>
81
  </ul>
82
 
83
  </div>
100
  </li>
101
  <?php } ?>
102
 
103
+ <?php
104
+ $disable_course_duration = get_tutor_option('disable_course_duration');
105
+ $disable_total_enrolled = get_tutor_option('disable_course_total_enrolled');
106
+ $disable_update_date = get_tutor_option('disable_course_update_date');
107
+ $course_duration = get_tutor_course_duration_context();
108
+
109
+ if( !empty($course_duration) && !$disable_course_duration){ ?>
110
  <li>
111
+ <span><?php esc_html_e('Duration', 'tutor') ?></span>
112
  <?php echo $course_duration; ?>
113
  </li>
114
+ <?php }
115
+
116
+ if( !$disable_total_enrolled){ ?>
117
+ <li>
118
+ <span><?php esc_html_e('Total Enrolled', 'tutor') ?></span>
119
+ <?php echo (int) tutor_utils()->count_enrolled_users_by_course(); ?>
120
+ </li>
121
+ <?php }
122
+
123
+ if( !$disable_update_date){ ?>
124
+ <li>
125
+ <span><?php esc_html_e('Last Update', 'tutor') ?></span>
126
+ <?php echo esc_html(get_the_modified_date()); ?>
127
+ </li>
128
+ <?php } ?>
129
  </ul>
130
  </div>
131
 
134
 
135
  <?php
136
  $excerpt = tutor_get_the_excerpt();
137
+ $disable_about = get_tutor_option('disable_course_about');
138
+ if (! empty($excerpt) && ! $disable_about){
139
  ?>
140
  <div class="tutor-course-summery">
141
  <h4 class="tutor-segment-title"><?php esc_html_e('About Course', 'tutor') ?></h4>
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.4.7
8
  Author URI: http://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.4.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.4.8
8
  Author URI: http://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.4.8');
21
  define('TUTOR_FILE', __FILE__);
22
 
23
  /**