LearnPress – WordPress LMS Plugin - Version 3.0.8

Version Description

~ Improved: get css class name for items for performance ~ Improved: check item is blocked for performance ~ Improved: upgrade database feature ~ Fixed: warning message when searching posts in frontend ~ Fixed: show 2 comments form in lesson page ~ Fixed: content of lesson does not show if set post-format to video ~ Fixed: some warning when getting question class with an array of post-type ~ Fixed: mysql error when updating item's grade with value is null

Download this release

Release Info

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

Code changes from version 3.0.7 to 3.0.8

Files changed (136) hide show
  1. assets/css/admin/admin.css +58 -41
  2. assets/css/learnpress.css +117 -83
  3. assets/js/admin/admin.js +9 -3
  4. assets/js/admin/course-editor.js +2 -1
  5. assets/js/admin/quiz-editor.js +10 -8
  6. assets/js/admin/update.js +1 -1
  7. assets/js/frontend/course.js +4 -1
  8. assets/js/frontend/profile.js +1 -1
  9. assets/js/frontend/quiz.js +19 -4
  10. assets/scss/_mixin.scss +41 -1
  11. assets/scss/admin/_admin-editor.scss +7 -46
  12. assets/scss/admin/_admin-tools.scss +9 -1
  13. assets/scss/admin/_general.scss +1 -1
  14. assets/scss/admin/_question-editor.scss +1 -2
  15. assets/scss/admin/_quiz-editor.scss +0 -9
  16. assets/scss/admin/admin.scss +12 -0
  17. assets/scss/frontend/_curriculum.scss +0 -87
  18. assets/scss/frontend/_quiz.scss +142 -25
  19. inc/abstract-settings.php +10 -0
  20. inc/abstracts/abstract-background-process.php +14 -4
  21. inc/admin/class-lp-admin-dashboard.php +2 -2
  22. inc/admin/class-lp-admin-menu.php +0 -2
  23. inc/admin/class-lp-admin.php +4 -0
  24. inc/admin/class-lp-reset-data.php +31 -6
  25. inc/admin/class-lp-updater.php +85 -25
  26. inc/admin/editor/class-lp-admin-editor.php +2 -0
  27. inc/admin/helpers/class-lp-plugins-helper.php +6 -6
  28. inc/admin/lp-admin-functions.php +29 -12
  29. inc/admin/meta-box/fields/course-permalink.php +33 -25
  30. inc/admin/meta-box/fields/email-content.php +6 -7
  31. inc/admin/meta-box/fields/list-emails.php +0 -1
  32. inc/admin/settings/abstract-settings-page.php +1 -0
  33. inc/admin/settings/class-lp-settings-courses.php +23 -23
  34. inc/admin/settings/class-lp-settings-emails.php +11 -0
  35. inc/admin/views/course/curriculum.php +1 -1
  36. inc/admin/views/course/editor.php +2 -2
  37. inc/admin/views/course/modal-choose-items.php +1 -1
  38. inc/admin/views/course/new-section-item.php +2 -2
  39. inc/admin/views/course/section-item.php +10 -13
  40. inc/admin/views/course/section.php +18 -3
  41. inc/admin/views/dashboard/plugin-status/html-results.php +1 -1
  42. inc/admin/views/meta-boxes/order/child-order.php +41 -0
  43. inc/admin/views/meta-boxes/order/details.php +8 -5
  44. inc/admin/views/question/option.php +7 -1
  45. inc/admin/views/quiz/editor.php +1 -1
  46. inc/admin/views/quiz/question-actions.php +31 -12
  47. inc/admin/views/quiz/question-answer-option.php +1 -1
  48. inc/admin/views/quiz/question-answer.php +2 -2
  49. inc/admin/views/quiz/question-settings.php +2 -2
  50. inc/admin/views/tools/course/html-course.php +23 -11
  51. inc/admin/views/tools/course/html-user-item.php +5 -5
  52. inc/admin/views/tools/course/html-user.php +51 -15
  53. inc/admin/views/updates/html-updated-latest-message.php +17 -0
  54. inc/admin/views/updates/html-updating-message.php +51 -0
  55. inc/background-process/class-lp-background-clear-temp-users.php +3 -1
  56. inc/background-process/class-lp-background-emailer.php +4 -1
  57. inc/background-process/class-lp-background-global.php +8 -3
  58. inc/background-process/class-lp-background-installer.php +41 -3
  59. inc/background-process/class-lp-background-query-items.php +5 -2
  60. inc/background-process/class-lp-background-schedule-items.php +58 -40
  61. inc/class-lp-ajax.php +2 -3
  62. inc/class-lp-checkout.php +5 -0
  63. inc/class-lp-debug.php +76 -4
  64. inc/class-lp-emails.php +57 -19
  65. inc/class-lp-forms-handler.php +1 -1
  66. inc/class-lp-install.php +25 -10
  67. inc/class-lp-market-products.php +40 -0
  68. inc/class-lp-page-controller.php +3 -6
  69. inc/class-lp-query.php +1 -0
  70. inc/class-lp-request-handler.php +35 -18
  71. inc/class-lp-schedules.php +7 -9
  72. inc/class-lp-session-handler.php +12 -2
  73. inc/course/abstract-course.php +15 -2
  74. inc/course/class-lp-course-item.php +220 -117
  75. inc/course/lp-course-functions.php +16 -3
  76. inc/curds/class-lp-order-curd.php +96 -95
  77. inc/curds/class-lp-question-curd.php +1 -1
  78. inc/curds/class-lp-quiz-curd.php +5 -5
  79. inc/curds/class-lp-user-curd.php +104 -5
  80. inc/curds/class-lp-user-item-curd.php +2 -1
  81. inc/custom-post-types/abstract.php +78 -12
  82. inc/custom-post-types/course.php +3 -3
  83. inc/custom-post-types/lesson.php +18 -1
  84. inc/custom-post-types/order.php +24 -5
  85. inc/custom-post-types/question.php +18 -4
  86. inc/custom-post-types/quiz.php +20 -18
  87. inc/emails/_bk/class-lp-email-finished-course-admin.php +0 -199
  88. inc/emails/_bk/class-lp-email-finished-course-instructor.php +0 -201
  89. inc/emails/_bk/class-lp-email-finished-course-user.php +0 -201
  90. inc/emails/class-lp-email-new-order-admin.php +10 -3
  91. inc/emails/class-lp-email.php +30 -16
  92. inc/emails/types/class-lp-email-type-enrolled-course.php +40 -0
  93. inc/lesson/class-lp-lesson.php +1 -0
  94. inc/lesson/lp-lesson-functions.php +7 -3
  95. inc/lp-constants.php +7 -2
  96. inc/lp-core-functions.php +88 -28
  97. inc/lp-template-functions.php +68 -46
  98. inc/lp-template-hooks.php +5 -1
  99. inc/order/lp-order-functions.php +1 -1
  100. inc/question/class-lp-question-answers.php +15 -5
  101. inc/question/class-lp-question-true-or-false.php +8 -6
  102. inc/question/class-lp-question.php +10 -4
  103. inc/quiz/class-lp-quiz-factory.php +28 -8
  104. inc/quiz/class-lp-quiz.php +43 -7
  105. inc/quiz/lp-quiz-functions.php +19 -17
  106. inc/updates/learnpress-update-3.0.0.php +295 -199
  107. inc/updates/learnpress-update-3.0.4.php +11 -24
  108. inc/updates/learnpress-update-3.0.8.php +29 -0
  109. inc/updates/learnpress-update-base.php +121 -0
  110. inc/user-item/class-lp-user-item-course.php +43 -3
  111. inc/user-item/class-lp-user-item-quiz.php +26 -9
  112. inc/user-item/class-lp-user-item.php +13 -7
  113. inc/user/abstract-lp-user.php +169 -463
  114. inc/user/class-lp-profile.php +13 -1
  115. inc/user/class-lp-user-factory.php +16 -13
  116. inc/user/lp-user-functions.php +80 -58
  117. languages/learnpress.pot +778 -737
  118. learnpress.php +94 -15
  119. readme.txt +11 -2
  120. templates/checkout/order-received.php +29 -2
  121. templates/content-question/multi-choice/answer-options.php +1 -0
  122. templates/content-quiz/buttons/check.php +0 -1
  123. templates/content-quiz/buttons/nav.php +7 -3
  124. templates/content-quiz/history.php +1 -1
  125. templates/content-quiz/progress.php +5 -7
  126. templates/content-quiz/question-numbers.php +9 -12
  127. templates/emails/email-footer.php +3 -1
  128. templates/emails/email-header.php +5 -2
  129. templates/global/blank-comments.php +4 -0
  130. templates/{content-lesson → global}/block-content.php +5 -3
  131. templates/global/comments.php +0 -0
  132. templates/global/scripts.php +1 -1
  133. templates/profile/tabs/quizzes.php +3 -6
  134. templates/single-course/content-item.php +10 -5
  135. templates/single-course/content-protected.php +11 -2
  136. templates/single-course/status.php +1 -1
assets/css/admin/admin.css CHANGED
@@ -1,6 +1,30 @@
1
  /**
2
  * Mixin
3
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  /**
5
  * Styles for displaying list of table
6
  */
@@ -494,7 +518,7 @@
494
  .learn-press-payments th, .learn-press-payments td,
495
  .learn-press-emails th,
496
  .learn-press-emails td {
497
- padding: 8px 10px; }
498
  .learn-press-payments .order,
499
  .learn-press-emails .order {
500
  width: 30px;
@@ -1801,30 +1825,6 @@
1801
  /**
1802
  * General style for admin editor.
1803
  */
1804
- @-webkit-keyframes rotating4 /* Safari and Chrome */ {
1805
- from {
1806
- -webkit-transform: rotate(0deg);
1807
- -o-transform: rotate(0deg);
1808
- transform: rotate(0deg); }
1809
- to {
1810
- -webkit-transform: rotate(360deg);
1811
- -o-transform: rotate(360deg);
1812
- transform: rotate(360deg); } }
1813
-
1814
- @keyframes rotating4 {
1815
- from {
1816
- -ms-transform: rotate(0deg);
1817
- -moz-transform: rotate(0deg);
1818
- -webkit-transform: rotate(0deg);
1819
- -o-transform: rotate(0deg);
1820
- transform: rotate(0deg); }
1821
- to {
1822
- -ms-transform: rotate(360deg);
1823
- -moz-transform: rotate(360deg);
1824
- -webkit-transform: rotate(360deg);
1825
- -o-transform: rotate(360deg);
1826
- transform: rotate(360deg); } }
1827
-
1828
  .lp-admin-editor {
1829
  background-color: #fff;
1830
  border: 1px solid #ddd;
@@ -2011,7 +2011,8 @@
2011
  border-collapse: collapse; }
2012
  #admin-editor-lp_course .lp-course-curriculum .section-list-items ul {
2013
  margin: 0;
2014
- min-height: 5px; }
 
2015
  #admin-editor-lp_course .lp-course-curriculum .section-list-items .section-item {
2016
  border: 1px solid #eee;
2017
  position: relative;
@@ -2233,7 +2234,6 @@
2233
  line-height: 44px;
2234
  font-size: 12px; }
2235
  .section-item-counts span {
2236
- font-weight: bold;
2237
  color: #999; }
2238
 
2239
  /**
@@ -2293,7 +2293,6 @@
2293
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .table-row > .order {
2294
  flex: 0 0 30px;
2295
  text-align: right;
2296
- font-weight: bold;
2297
  font-size: 15px;
2298
  padding: 12px 0; }
2299
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .table-row > .order:after {
@@ -2354,8 +2353,7 @@
2354
  height: 42px; }
2355
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .main .question-settings .quiz-question-data table.lp-list-options tbody tr {
2356
  background: #fff;
2357
- border: 1px solid #DDD;
2358
- position: relative; }
2359
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .main .question-settings .quiz-question-data table.lp-list-options tbody tr:nth-child(2n) {
2360
  background: #f4fcff; }
2361
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .main .question-settings .quiz-question-data table.lp-list-options tbody tr td {
@@ -2365,10 +2363,7 @@
2365
  border: none; }
2366
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .main .question-settings .quiz-question-data table.lp-list-options tbody tr td.sort {
2367
  cursor: url("../../images/openhand.cur") 7 5, default;
2368
- width: 12px;
2369
- position: relative; }
2370
- #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .main .question-settings .quiz-question-data table.lp-list-options tbody tr td.order {
2371
- font-weight: bold; }
2372
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .main .question-settings .quiz-question-data table.lp-list-options tbody tr td.answer-text {
2373
  padding-left: 5px; }
2374
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .main .question-settings .quiz-question-data table.lp-list-options tbody tr td.answer-correct {
@@ -2630,7 +2625,7 @@
2630
  #admin-editor-lp_quiz .lp-box-data-content .question-button-actions {
2631
  text-align: left; }
2632
 
2633
- /**
2634
  * Question admin editor.
2635
  */
2636
  #admin-editor-lp_question {
@@ -2715,8 +2710,7 @@
2715
  #admin-editor-lp_question .lp-box-data-content table.list-question-answers .order {
2716
  text-align: right;
2717
  padding: 0;
2718
- width: 30px;
2719
- font-weight: bold; }
2720
  #admin-editor-lp_question .lp-box-data-content table.list-question-answers .answer-correct {
2721
  width: 65px;
2722
  text-align: center; }
@@ -2956,10 +2950,8 @@
2956
  #lp-modal-choose-items .lp-choose-items .footer {
2957
  padding: 20px; }
2958
 
2959
- body.moving {
2960
  cursor: url("../../images/closedhand.cur") 7 5, default !important; }
2961
- body.moving .section-item .drag {
2962
- cursor: url("../../images/closedhand.cur") 7 5, default !important; }
2963
 
2964
  @media screen and (max-width: 900px) {
2965
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .question-settings.table-row {
@@ -2985,9 +2977,21 @@ body.moving {
2985
  #learn-press-reset-course-users input[type="text"],
2986
  #learn-press-reset-user-courses input[type="text"],
2987
  #learn-press-reset-user-item input[type="text"] {
2988
- min-width: 200px;
2989
  height: 28px;
2990
  margin-left: 0; }
 
 
 
 
 
 
 
 
 
 
 
 
2991
 
2992
  .learn-press-tip {
2993
  display: none;
@@ -3092,6 +3096,19 @@ body.moving {
3092
 
3093
  .lp-notice-update-database {
3094
  border-left-color: #FF0000; }
 
 
 
 
 
 
 
 
 
 
 
 
 
3095
 
3096
  #adminmenu .update-plugins.lp-plugins-count {
3097
  padding: 0 5px; }
1
  /**
2
  * Mixin
3
  */
4
+ @-webkit-keyframes rotating4 /* Safari and Chrome */ {
5
+ from {
6
+ -webkit-transform: rotate(0deg);
7
+ -o-transform: rotate(0deg);
8
+ transform: rotate(0deg); }
9
+ to {
10
+ -webkit-transform: rotate(360deg);
11
+ -o-transform: rotate(360deg);
12
+ transform: rotate(360deg); } }
13
+
14
+ @keyframes rotating4 {
15
+ from {
16
+ -ms-transform: rotate(0deg);
17
+ -moz-transform: rotate(0deg);
18
+ -webkit-transform: rotate(0deg);
19
+ -o-transform: rotate(0deg);
20
+ transform: rotate(0deg); }
21
+ to {
22
+ -ms-transform: rotate(360deg);
23
+ -moz-transform: rotate(360deg);
24
+ -webkit-transform: rotate(360deg);
25
+ -o-transform: rotate(360deg);
26
+ transform: rotate(360deg); } }
27
+
28
  /**
29
  * Styles for displaying list of table
30
  */
518
  .learn-press-payments th, .learn-press-payments td,
519
  .learn-press-emails th,
520
  .learn-press-emails td {
521
+ padding: 10px; }
522
  .learn-press-payments .order,
523
  .learn-press-emails .order {
524
  width: 30px;
1825
  /**
1826
  * General style for admin editor.
1827
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1828
  .lp-admin-editor {
1829
  background-color: #fff;
1830
  border: 1px solid #ddd;
2011
  border-collapse: collapse; }
2012
  #admin-editor-lp_course .lp-course-curriculum .section-list-items ul {
2013
  margin: 0;
2014
+ min-height: 5px;
2015
+ position: relative; }
2016
  #admin-editor-lp_course .lp-course-curriculum .section-list-items .section-item {
2017
  border: 1px solid #eee;
2018
  position: relative;
2234
  line-height: 44px;
2235
  font-size: 12px; }
2236
  .section-item-counts span {
 
2237
  color: #999; }
2238
 
2239
  /**
2293
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .table-row > .order {
2294
  flex: 0 0 30px;
2295
  text-align: right;
 
2296
  font-size: 15px;
2297
  padding: 12px 0; }
2298
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .table-row > .order:after {
2353
  height: 42px; }
2354
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .main .question-settings .quiz-question-data table.lp-list-options tbody tr {
2355
  background: #fff;
2356
+ border: 1px solid #DDD; }
 
2357
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .main .question-settings .quiz-question-data table.lp-list-options tbody tr:nth-child(2n) {
2358
  background: #f4fcff; }
2359
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .main .question-settings .quiz-question-data table.lp-list-options tbody tr td {
2363
  border: none; }
2364
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .main .question-settings .quiz-question-data table.lp-list-options tbody tr td.sort {
2365
  cursor: url("../../images/openhand.cur") 7 5, default;
2366
+ width: 12px; }
 
 
 
2367
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .main .question-settings .quiz-question-data table.lp-list-options tbody tr td.answer-text {
2368
  padding-left: 5px; }
2369
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .main .question-settings .quiz-question-data table.lp-list-options tbody tr td.answer-correct {
2625
  #admin-editor-lp_quiz .lp-box-data-content .question-button-actions {
2626
  text-align: left; }
2627
 
2628
+ /**.section-item-counts span
2629
  * Question admin editor.
2630
  */
2631
  #admin-editor-lp_question {
2710
  #admin-editor-lp_question .lp-box-data-content table.list-question-answers .order {
2711
  text-align: right;
2712
  padding: 0;
2713
+ width: 30px; }
 
2714
  #admin-editor-lp_question .lp-box-data-content table.list-question-answers .answer-correct {
2715
  width: 65px;
2716
  text-align: center; }
2950
  #lp-modal-choose-items .lp-choose-items .footer {
2951
  padding: 20px; }
2952
 
2953
+ body.lp-item-moving {
2954
  cursor: url("../../images/closedhand.cur") 7 5, default !important; }
 
 
2955
 
2956
  @media screen and (max-width: 900px) {
2957
  #admin-editor-lp_quiz .lp-box-data-content .lp-list-questions .question-settings.table-row {
2977
  #learn-press-reset-course-users input[type="text"],
2978
  #learn-press-reset-user-courses input[type="text"],
2979
  #learn-press-reset-user-item input[type="text"] {
2980
+ min-width: 300px;
2981
  height: 28px;
2982
  margin-left: 0; }
2983
+ #learn-press-reset-course-users .action-reset.dashicons-trash,
2984
+ #learn-press-reset-user-courses .action-reset.dashicons-trash,
2985
+ #learn-press-reset-user-item .action-reset.dashicons-trash {
2986
+ color: #FF0000; }
2987
+ #learn-press-reset-course-users .action-reset.dashicons-update,
2988
+ #learn-press-reset-user-courses .action-reset.dashicons-update,
2989
+ #learn-press-reset-user-item .action-reset.dashicons-update {
2990
+ -webkit-animation: rotating4 2s linear infinite;
2991
+ -moz-animation: rotating4 2s linear infinite;
2992
+ -ms-animation: rotating4 2s linear infinite;
2993
+ -o-animation: rotating4 2s linear infinite;
2994
+ animation: rotating4 2s linear infinite; }
2995
 
2996
  .learn-press-tip {
2997
  display: none;
3096
 
3097
  .lp-notice-update-database {
3098
  border-left-color: #FF0000; }
3099
+ .lp-notice-update-database.do-updating:before {
3100
+ display: inline-block;
3101
+ content: "\f463";
3102
+ font-family: dashicons;
3103
+ font-size: 20px;
3104
+ float: left;
3105
+ margin: 9px 5px 0 -5px;
3106
+ color: #2773aa;
3107
+ -webkit-animation: rotating4 2s linear infinite;
3108
+ -moz-animation: rotating4 2s linear infinite;
3109
+ -ms-animation: rotating4 2s linear infinite;
3110
+ -o-animation: rotating4 2s linear infinite;
3111
+ animation: rotating4 2s linear infinite; }
3112
 
3113
  #adminmenu .update-plugins.lp-plugins-count {
3114
  padding: 0 5px; }
assets/css/learnpress.css CHANGED
@@ -1,6 +1,30 @@
1
  /**
2
  * Mixin
3
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  @keyframes lp-rotating {
5
  from {
6
  transform: rotate(0deg);
@@ -1011,60 +1035,6 @@ body .lp-quiz-buttons .form-button-finish-course {
1011
  .scroll-wrapper:hover .scroll-element.scroll-y.scroll-scrolly_visible {
1012
  opacity: 0.7; }
1013
 
1014
- .question-numbers {
1015
- list-style: none;
1016
- text-align: center; }
1017
- .question-numbers li {
1018
- display: inline-block; }
1019
- .question-numbers li a {
1020
- display: block;
1021
- padding: 8px;
1022
- background: #F5F5F5;
1023
- line-height: 1;
1024
- color: #999;
1025
- border: 1px solid #DDD;
1026
- font-size: 12px;
1027
- min-width: 20px;
1028
- box-shadow: none; }
1029
- .question-numbers li a span {
1030
- vertical-align: middle; }
1031
- .question-numbers li a:hover {
1032
- background: #00adff;
1033
- color: #FFF;
1034
- border: 1px solid #3880a2; }
1035
- .question-numbers li.current a {
1036
- background: #00adff;
1037
- color: #FFF !important;
1038
- border-color: #3880a2; }
1039
- .question-numbers li.answered a:after {
1040
- font-family: fontawesome;
1041
- font-size: 8px;
1042
- vertical-align: middle;
1043
- margin-left: 3px; }
1044
- .question-numbers li.answered.answered-wrong a {
1045
- color: #FF0000; }
1046
- .question-numbers li.answered.answered-true a {
1047
- color: #00adff; }
1048
- .question-numbers li.answered.answered-true.current a {
1049
- color: #FFF; }
1050
-
1051
- .quiz-intro {
1052
- list-style: none;
1053
- margin: 0 0 20px;
1054
- padding: 0;
1055
- display: table; }
1056
- .quiz-intro li {
1057
- margin: 0;
1058
- display: table-row; }
1059
- .quiz-intro li label, .quiz-intro li span {
1060
- display: table-cell; }
1061
- .quiz-intro li label {
1062
- font-weight: bold;
1063
- padding: 0 20px 10px 0px;
1064
- line-height: 1; }
1065
- .quiz-intro li span {
1066
- text-align: left; }
1067
-
1068
  .course-remaining-time .lp-label.label-enrolled {
1069
  font-size: inherit; }
1070
 
@@ -1432,35 +1402,7 @@ body .lp-quiz-buttons .form-button-finish-course {
1432
  .answer-options .answer-option.answered-wrong input[type="radio"]:before, .answer-options .answer-option.answered-wrong input[type="radio"]:after,
1433
  .answer-options .answer-option.answered-wrong input[type="checkbox"]:before,
1434
  .answer-options .answer-option.answered-wrong input[type="checkbox"]:after {
1435
- position: absolute;
1436
- background: #FF0000;
1437
- border: none;
1438
- content: '';
1439
- display: inline-block;
1440
- left: 50%;
1441
- top: 50%;
1442
- -webkit-border-radius: 2px;
1443
- -moz-border-radius: 2px;
1444
- border-radius: 2px;
1445
- -webkit-transform: rotate(-45deg);
1446
- -moz-transform: rotate(-45deg);
1447
- -ms-transform: rotate(-45deg);
1448
- -o-transform: rotate(-45deg);
1449
- transform: rotate(-45deg); }
1450
- .answer-options .answer-option.answered-wrong input[type="radio"]:before,
1451
- .answer-options .answer-option.answered-wrong input[type="checkbox"]:before {
1452
- width: 2px;
1453
- height: 18px;
1454
- margin-top: -9px;
1455
- margin-left: -1px; }
1456
- .answer-options .answer-option.answered-wrong input[type="radio"]:after,
1457
- .answer-options .answer-option.answered-wrong input[type="checkbox"]:after {
1458
- width: 18px;
1459
- height: 2px;
1460
- margin-top: -1px;
1461
- margin-left: -9px;
1462
- border: none;
1463
- opacity: 1; }
1464
  .answer-options .answer-option.answered-wrong input[type="radio"]:checked ~ .option-title:before,
1465
  .answer-options .answer-option.answered-wrong input[type="checkbox"]:checked ~ .option-title:before {
1466
  background: #FF0000; }
@@ -1509,6 +1451,74 @@ button[data-counter] {
1509
  .quiz-result .result-statistic .result-statistic-field p {
1510
  text-align: right; }
1511
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1512
  .question-explanation-content,
1513
  .question-hint-content {
1514
  margin-bottom: 20px;
@@ -1704,6 +1714,30 @@ body.lp-preview #course-item-content-header {
1704
  /**
1705
  * Mixin
1706
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1707
  #popup_container {
1708
  opacity: 0;
1709
  transform: scale(0.5); }
1
  /**
2
  * Mixin
3
  */
4
+ @-webkit-keyframes rotating4 /* Safari and Chrome */ {
5
+ from {
6
+ -webkit-transform: rotate(0deg);
7
+ -o-transform: rotate(0deg);
8
+ transform: rotate(0deg); }
9
+ to {
10
+ -webkit-transform: rotate(360deg);
11
+ -o-transform: rotate(360deg);
12
+ transform: rotate(360deg); } }
13
+
14
+ @keyframes rotating4 {
15
+ from {
16
+ -ms-transform: rotate(0deg);
17
+ -moz-transform: rotate(0deg);
18
+ -webkit-transform: rotate(0deg);
19
+ -o-transform: rotate(0deg);
20
+ transform: rotate(0deg); }
21
+ to {
22
+ -ms-transform: rotate(360deg);
23
+ -moz-transform: rotate(360deg);
24
+ -webkit-transform: rotate(360deg);
25
+ -o-transform: rotate(360deg);
26
+ transform: rotate(360deg); } }
27
+
28
  @keyframes lp-rotating {
29
  from {
30
  transform: rotate(0deg);
1035
  .scroll-wrapper:hover .scroll-element.scroll-y.scroll-scrolly_visible {
1036
  opacity: 0.7; }
1037
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1038
  .course-remaining-time .lp-label.label-enrolled {
1039
  font-size: inherit; }
1040
 
1402
  .answer-options .answer-option.answered-wrong input[type="radio"]:before, .answer-options .answer-option.answered-wrong input[type="radio"]:after,
1403
  .answer-options .answer-option.answered-wrong input[type="checkbox"]:before,
1404
  .answer-options .answer-option.answered-wrong input[type="checkbox"]:after {
1405
+ border-color: #FF0000; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1406
  .answer-options .answer-option.answered-wrong input[type="radio"]:checked ~ .option-title:before,
1407
  .answer-options .answer-option.answered-wrong input[type="checkbox"]:checked ~ .option-title:before {
1408
  background: #FF0000; }
1451
  .quiz-result .result-statistic .result-statistic-field p {
1452
  text-align: right; }
1453
 
1454
+ .question-numbers {
1455
+ list-style: none;
1456
+ text-align: center; }
1457
+ .question-numbers li {
1458
+ display: inline-block;
1459
+ position: relative;
1460
+ margin-bottom: 3px; }
1461
+ .question-numbers li a {
1462
+ display: block;
1463
+ padding: 8px;
1464
+ background: #F5F5F5;
1465
+ line-height: 1;
1466
+ color: #999;
1467
+ border: 1px solid #DDD;
1468
+ font-size: 12px;
1469
+ min-width: 20px;
1470
+ box-shadow: none; }
1471
+ .question-numbers li a span {
1472
+ vertical-align: middle; }
1473
+ .question-numbers li a:hover {
1474
+ background: #00adff;
1475
+ color: #FFF;
1476
+ border: 1px solid #3880a2; }
1477
+ .question-numbers li.current a {
1478
+ background: #00adff;
1479
+ color: #FFF !important;
1480
+ border-color: #3880a2; }
1481
+ .question-numbers li.current.skipped:after {
1482
+ background: #FFF; }
1483
+ .question-numbers li.answered a:after {
1484
+ font-family: fontawesome;
1485
+ font-size: 8px;
1486
+ vertical-align: middle;
1487
+ margin-left: 3px; }
1488
+ .question-numbers li.answered.answered-wrong a {
1489
+ color: #FF0000; }
1490
+ .question-numbers li.answered.answered-true a {
1491
+ color: #00adff; }
1492
+ .question-numbers li.answered.answered-true.current a {
1493
+ color: #FFF; }
1494
+ .question-numbers li.skipped:after {
1495
+ content: '';
1496
+ background: #AAA;
1497
+ width: 10px;
1498
+ height: 4px;
1499
+ position: absolute;
1500
+ border-radius: 2px;
1501
+ left: 50%;
1502
+ margin-left: -5px;
1503
+ bottom: 3px; }
1504
+
1505
+ .quiz-intro {
1506
+ list-style: none;
1507
+ margin: 0 0 20px;
1508
+ padding: 0;
1509
+ display: table; }
1510
+ .quiz-intro li {
1511
+ margin: 0;
1512
+ display: table-row; }
1513
+ .quiz-intro li label, .quiz-intro li span {
1514
+ display: table-cell; }
1515
+ .quiz-intro li label {
1516
+ font-weight: bold;
1517
+ padding: 0 20px 10px 0px;
1518
+ line-height: 1; }
1519
+ .quiz-intro li span {
1520
+ text-align: left; }
1521
+
1522
  .question-explanation-content,
1523
  .question-hint-content {
1524
  margin-bottom: 20px;
1714
  /**
1715
  * Mixin
1716
  */
1717
+ @-webkit-keyframes rotating4 /* Safari and Chrome */ {
1718
+ from {
1719
+ -webkit-transform: rotate(0deg);
1720
+ -o-transform: rotate(0deg);
1721
+ transform: rotate(0deg); }
1722
+ to {
1723
+ -webkit-transform: rotate(360deg);
1724
+ -o-transform: rotate(360deg);
1725
+ transform: rotate(360deg); } }
1726
+
1727
+ @keyframes rotating4 {
1728
+ from {
1729
+ -ms-transform: rotate(0deg);
1730
+ -moz-transform: rotate(0deg);
1731
+ -webkit-transform: rotate(0deg);
1732
+ -o-transform: rotate(0deg);
1733
+ transform: rotate(0deg); }
1734
+ to {
1735
+ -ms-transform: rotate(360deg);
1736
+ -moz-transform: rotate(360deg);
1737
+ -webkit-transform: rotate(360deg);
1738
+ -o-transform: rotate(360deg);
1739
+ transform: rotate(360deg); } }
1740
+
1741
  #popup_container {
1742
  opacity: 0;
1743
  transform: scale(0.5); }
assets/js/admin/admin.js CHANGED
@@ -379,7 +379,6 @@
379
  }
380
 
381
 
382
-
383
  var $doc = $(document);
384
 
385
  function _ready() {
@@ -403,8 +402,15 @@
403
  .on('click', '.lp-upgrade-notice .close-notice', hideUpgradeMessage)
404
  .on('click', '.plugin-action-buttons a', pluginActions)
405
  .on('click', '.learn-press-filter-template', _callbackFilterTemplates)
406
- .on('click', '.lp-duplicate-row-action .lp-duplicate-post', _duplicatePost);
407
-
 
 
 
 
 
 
 
408
  LP_Admin.init();
409
  }
410
 
379
  }
380
 
381
 
 
382
  var $doc = $(document);
383
 
384
  function _ready() {
402
  .on('click', '.lp-upgrade-notice .close-notice', hideUpgradeMessage)
403
  .on('click', '.plugin-action-buttons a', pluginActions)
404
  .on('click', '.learn-press-filter-template', _callbackFilterTemplates)
405
+ .on('click', '.lp-duplicate-row-action .lp-duplicate-post', _duplicatePost)
406
+ .on('mousedown', '.lp-sortable-handle', function (e) {
407
+ $('html, body').addClass('lp-item-moving');
408
+ $(e.target).closest('.lp-sortable-handle').css('cursor', 'inherit');
409
+ })
410
+ .on('mouseup', function (e) {
411
+ $('html, body').removeClass('lp-item-moving');
412
+ $('.lp-sortable-handle').css('cursor', '');
413
+ })
414
  LP_Admin.init();
415
  }
416
 
assets/js/admin/course-editor.js CHANGED
@@ -15,7 +15,7 @@
15
  };
16
  })(window);
17
 
18
- jQuery(function () {
19
 
20
 
21
  /**
@@ -857,6 +857,7 @@ jQuery(function () {
857
  */
858
  (function ($, Vue, $store) {
859
  $(document).ready(function () {
 
860
  window.LP_Course_Editor = new Vue({
861
  el: '#admin-editor-lp_course',
862
  template: '<lp-course-editor></lp-course-editor>'
15
  };
16
  })(window);
17
 
18
+ jQuery(function ($) {
19
 
20
 
21
  /**
857
  */
858
  (function ($, Vue, $store) {
859
  $(document).ready(function () {
860
+ console.log($('#admin-editor-lp_course'))
861
  window.LP_Course_Editor = new Vue({
862
  el: '#admin-editor-lp_course',
863
  template: '<lp-course-editor></lp-course-editor>'
assets/js/admin/quiz-editor.js CHANGED
@@ -324,7 +324,7 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
324
  var found = false;
325
  if (question.temp_id) {
326
  for (var i = 0, n = state.questions.length; i < n; i++) {
327
- if (state.questions[i].id == question.temp_id) {
328
  Vue.set(state.questions, i, question);
329
  found = true;
330
  break;
@@ -332,13 +332,13 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
332
  }
333
  }
334
  if (!found) {
335
- state.questions.push(question);
336
- }
 
 
 
337
 
338
- var _last_child = $('.lp-list-questions .main > div:last-child');
339
- if (_last_child.length) {
340
- var _offset = _last_child.offset().top;
341
- $('html,body').animate({scrollTop: _offset});
342
  }
343
  },
344
  'CHANGE_QUESTION_TYPE': function (state, data) {
@@ -745,7 +745,9 @@ var LP_List_Quiz_Questions_Store = (function (Vue, helpers, data, $) {
745
  context.commit('ADD_QUESTION_ANSWER', {question_id: question_id, answer: answer});
746
  context.commit('UPDATE_QUESTION_SUCCESS', question_id);
747
 
748
- data.success && setTimeout(function(){data.success.apply(data.context, [answer]);}, 300);
 
 
749
  }
750
  },
751
  function (error) {
324
  var found = false;
325
  if (question.temp_id) {
326
  for (var i = 0, n = state.questions.length; i < n; i++) {
327
+ if (state.questions[i].id === question.temp_id) {
328
  Vue.set(state.questions, i, question);
329
  found = true;
330
  break;
332
  }
333
  }
334
  if (!found) {
335
+ var _last_child = $('.lp-list-questions .main > div:last-child');
336
+ if (_last_child.length) {
337
+ var _offset = _last_child.offset().top;
338
+ $('html,body').animate({scrollTop: _offset});
339
+ }
340
 
341
+ state.questions.push(question);
 
 
 
342
  }
343
  },
344
  'CHANGE_QUESTION_TYPE': function (state, data) {
745
  context.commit('ADD_QUESTION_ANSWER', {question_id: question_id, answer: answer});
746
  context.commit('UPDATE_QUESTION_SUCCESS', question_id);
747
 
748
+ data.success && setTimeout(function () {
749
+ data.success.apply(data.context, [answer]);
750
+ }, 300);
751
  }
752
  },
753
  function (error) {
assets/js/admin/update.js CHANGED
@@ -33,7 +33,7 @@
33
  context: context
34
  },
35
  success: function (res) {
36
- var $msg = $('<div class="notice notice-success"><p>' + $(res).find('#message-success').text() + '</p></div>');
37
  if (context == 'message') {
38
  $btn.closest('.notice').replaceWith($msg);
39
  } else {
33
  context: context
34
  },
35
  success: function (res) {
36
+ var $msg = $(res);
37
  if (context == 'message') {
38
  $btn.closest('.notice').replaceWith($msg);
39
  } else {
assets/js/frontend/course.js CHANGED
@@ -467,6 +467,10 @@
467
  setTimeout(function () {
468
  var $cs = $body.find('.curriculum-sections').parent();
469
  $cs.scrollTo($cs.find('.course-item.current'), 100);
 
 
 
 
470
  }, 300);
471
 
472
  $body.css('opacity', 1);
@@ -492,7 +496,6 @@
492
  return $.isArray(args) ? args[0] : undefined;
493
  },
494
  confirmHandle = function (e) {
495
-
496
  try {
497
  var $form = $(this),
498
  message = $form.data('confirm'),
467
  setTimeout(function () {
468
  var $cs = $body.find('.curriculum-sections').parent();
469
  $cs.scrollTo($cs.find('.course-item.current'), 100);
470
+
471
+ if (window.location.hash) {
472
+ $('.content-item-scrollable:last').scrollTo($(window.location.hash));
473
+ }
474
  }, 300);
475
 
476
  $body.css('opacity', 1);
496
  return $.isArray(args) ? args[0] : undefined;
497
  },
498
  confirmHandle = function (e) {
 
499
  try {
500
  var $form = $(this),
501
  message = $form.data('confirm'),
assets/js/frontend/profile.js CHANGED
@@ -358,4 +358,4 @@
358
  }
359
 
360
 
361
- })(jQuery);
358
  }
359
 
360
 
361
+ })(jQuery);
assets/js/frontend/quiz.js CHANGED
@@ -63,9 +63,9 @@
63
  }
64
 
65
  if (overtime) {
66
- // Disable confirm message
67
- $('form.complete-quiz').off('submit.learn-press-confirm');
68
- callbackEvents.callEvent('finish');
69
  return;
70
  }
71
  thisSettings.remainingTime--;
@@ -88,6 +88,9 @@
88
  callbackEvents.callEvent('tick', [newVal]);
89
  if (newVal <= 0) {
90
  stopCountdown();
 
 
 
91
  callbackEvents.callEvent('finish');
92
  }
93
  }
@@ -103,6 +106,16 @@
103
  $('form.complete-quiz').submit();
104
  }
105
 
 
 
 
 
 
 
 
 
 
 
106
  function init() {
107
  if (thisSettings.onTick) {
108
  self.on('tick', thisSettings.onTick);
@@ -111,6 +124,8 @@
111
  if (thisSettings.onFinish) {
112
  self.on('finish', thisSettings.onFinish);
113
  }
 
 
114
  initCountdown();
115
  timeCountdown();
116
  }
@@ -119,7 +134,7 @@
119
  this.on = callbackEvents.on;
120
  this.off = callbackEvents.off;
121
 
122
- if(thisSettings.totalTime > 0) {
123
  this.on('tick.showTime', showTime);
124
  this.on('finish.submit', submit);
125
  }
63
  }
64
 
65
  if (overtime) {
66
+ // console.log('Overtime')
67
+ // return;
68
+ //
69
  return;
70
  }
71
  thisSettings.remainingTime--;
88
  callbackEvents.callEvent('tick', [newVal]);
89
  if (newVal <= 0) {
90
  stopCountdown();
91
+
92
+ // Disable confirm message
93
+ $('form.complete-quiz').off('submit.learn-press-confirm');
94
  callbackEvents.callEvent('finish');
95
  }
96
  }
106
  $('form.complete-quiz').submit();
107
  }
108
 
109
+ function beforeSubmit() {
110
+ var $form = $(this),
111
+ $input = $form.find('input[name="nav-type"]'),
112
+ navType = $form[0].className.match(/(prev|next|skip)-question/);
113
+
114
+ if (!$input.length) {
115
+ $input = $('<input type="hidden" name="nav-type" />').val(navType[0]).appendTo($form);
116
+ }
117
+ }
118
+
119
  function init() {
120
  if (thisSettings.onTick) {
121
  self.on('tick', thisSettings.onTick);
124
  if (thisSettings.onFinish) {
125
  self.on('finish', thisSettings.onFinish);
126
  }
127
+
128
+ $(document).on('submit', '.next-question, .prev-question, .skip-question', beforeSubmit);
129
  initCountdown();
130
  timeCountdown();
131
  }
134
  this.on = callbackEvents.on;
135
  this.off = callbackEvents.off;
136
 
137
+ if (thisSettings.totalTime > 0) {
138
  this.on('tick.showTime', showTime);
139
  this.on('finish.submit', submit);
140
  }
assets/scss/_mixin.scss CHANGED
@@ -103,4 +103,44 @@
103
  &::placeholder{
104
  color: $color;
105
  }
106
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  &::placeholder{
104
  color: $color;
105
  }
106
+ }
107
+
108
+
109
+ @-webkit-keyframes rotating4 /* Safari and Chrome */
110
+ {
111
+ from {
112
+ -webkit-transform: rotate(0deg);
113
+ -o-transform: rotate(0deg);
114
+ transform: rotate(0deg);
115
+ }
116
+ to {
117
+ -webkit-transform: rotate(360deg);
118
+ -o-transform: rotate(360deg);
119
+ transform: rotate(360deg);
120
+ }
121
+ }
122
+
123
+ @keyframes rotating4 {
124
+ from {
125
+ -ms-transform: rotate(0deg);
126
+ -moz-transform: rotate(0deg);
127
+ -webkit-transform: rotate(0deg);
128
+ -o-transform: rotate(0deg);
129
+ transform: rotate(0deg);
130
+ }
131
+ to {
132
+ -ms-transform: rotate(360deg);
133
+ -moz-transform: rotate(360deg);
134
+ -webkit-transform: rotate(360deg);
135
+ -o-transform: rotate(360deg);
136
+ transform: rotate(360deg);
137
+ }
138
+ }
139
+
140
+ @mixin rotating4($args: rotating4 2s linear infinite) {
141
+ -webkit-animation: $args;
142
+ -moz-animation: $args;
143
+ -ms-animation: $args;
144
+ -o-animation: $args;
145
+ animation: $args;
146
+ }
assets/scss/admin/_admin-editor.scss CHANGED
@@ -2,45 +2,6 @@
2
  * General style for admin editor.
3
  */
4
 
5
- @-webkit-keyframes rotating4 /* Safari and Chrome */
6
- {
7
- from {
8
- -webkit-transform: rotate(0deg);
9
- -o-transform: rotate(0deg);
10
- transform: rotate(0deg);
11
- }
12
- to {
13
- -webkit-transform: rotate(360deg);
14
- -o-transform: rotate(360deg);
15
- transform: rotate(360deg);
16
- }
17
- }
18
-
19
- @keyframes rotating4 {
20
- from {
21
- -ms-transform: rotate(0deg);
22
- -moz-transform: rotate(0deg);
23
- -webkit-transform: rotate(0deg);
24
- -o-transform: rotate(0deg);
25
- transform: rotate(0deg);
26
- }
27
- to {
28
- -ms-transform: rotate(360deg);
29
- -moz-transform: rotate(360deg);
30
- -webkit-transform: rotate(360deg);
31
- -o-transform: rotate(360deg);
32
- transform: rotate(360deg);
33
- }
34
- }
35
-
36
- @mixin rotating4($args: rotating4 2s linear infinite) {
37
- -webkit-animation: $args;
38
- -moz-animation: $args;
39
- -ms-animation: $args;
40
- -o-animation: $args;
41
- animation: $args;
42
- }
43
-
44
  .lp-admin-editor {
45
  background-color: #fff;
46
  border: 1px solid #ddd;
@@ -319,6 +280,7 @@
319
  ul {
320
  margin: 0;
321
  min-height: 5px;
 
322
  }
323
 
324
  &.no-item {
@@ -671,7 +633,6 @@
671
  line-height: 44px;
672
  font-size: 12px;
673
  span {
674
- font-weight: bold;
675
  color: #999;
676
  }
677
  }
@@ -906,13 +867,13 @@
906
  }
907
 
908
  body {
909
- &.moving {
910
  cursor: url("../../images/closedhand.cur") 7 5, default !important;
911
- .section-item {
912
- .drag {
913
- cursor: url("../../images/closedhand.cur") 7 5, default !important;
914
- }
915
- }
916
  }
917
  }
918
 
2
  * General style for admin editor.
3
  */
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  .lp-admin-editor {
6
  background-color: #fff;
7
  border: 1px solid #ddd;
280
  ul {
281
  margin: 0;
282
  min-height: 5px;
283
+ position: relative;
284
  }
285
 
286
  &.no-item {
633
  line-height: 44px;
634
  font-size: 12px;
635
  span {
 
636
  color: #999;
637
  }
638
  }
867
  }
868
 
869
  body {
870
+ &.lp-item-moving {
871
  cursor: url("../../images/closedhand.cur") 7 5, default !important;
872
+ //.section-item {
873
+ // .drag {
874
+ // cursor: url("../../images/closedhand.cur") 7 5, default !important;
875
+ // }
876
+ //}
877
  }
878
  }
879
 
assets/scss/admin/_admin-tools.scss CHANGED
@@ -10,8 +10,16 @@
10
  margin: 0;
11
  }
12
  input[type="text"] {
13
- min-width: 200px;
14
  height: 28px;
15
  margin-left: 0;
16
  }
 
 
 
 
 
 
 
 
17
  }
10
  margin: 0;
11
  }
12
  input[type="text"] {
13
+ min-width: 300px;
14
  height: 28px;
15
  margin-left: 0;
16
  }
17
+ .action-reset {
18
+ &.dashicons-trash {
19
+ color: #FF0000;
20
+ }
21
+ &.dashicons-update {
22
+ @include rotating4();
23
+ }
24
+ }
25
  }
assets/scss/admin/_general.scss CHANGED
@@ -174,7 +174,7 @@
174
  width: 100%;
175
  font-size: 14px;
176
  th, td {
177
- padding: 8px 10px;
178
  }
179
  .order {
180
  width: 30px;
174
  width: 100%;
175
  font-size: 14px;
176
  th, td {
177
+ padding: 10px;
178
  }
179
  .order {
180
  width: 30px;
assets/scss/admin/_question-editor.scss CHANGED
@@ -1,4 +1,4 @@
1
- /**
2
  * Question admin editor.
3
  */
4
  #admin-editor-lp_question {
@@ -110,7 +110,6 @@
110
  text-align: right;
111
  padding: 0;
112
  width: 30px;
113
- font-weight: bold;
114
  }
115
  .answer-correct {
116
  width: 65px;
1
+ /**.section-item-counts span
2
  * Question admin editor.
3
  */
4
  #admin-editor-lp_question {
110
  text-align: right;
111
  padding: 0;
112
  width: 30px;
 
113
  }
114
  .answer-correct {
115
  width: 65px;
assets/scss/admin/_quiz-editor.scss CHANGED
@@ -72,7 +72,6 @@
72
  & > .order {
73
  flex: 0 0 30px;
74
  text-align: right;
75
- font-weight: bold;
76
  font-size: 15px;
77
  padding: 12px 0;
78
  &:after {
@@ -176,7 +175,6 @@
176
  tr {
177
  background: #fff;
178
  border: 1px solid #DDD;
179
- position: relative;
180
  &:nth-child(2n) {
181
  background: #f4fcff;
182
  }
@@ -188,15 +186,8 @@
188
  &.sort {
189
  cursor: url("../../images/openhand.cur") 7 5, default;
190
  width: 12px;
191
- position: relative;
192
 
193
  }
194
- &.order {
195
- font-weight: bold;
196
- &:after {
197
- //content: '.';
198
- }
199
- }
200
  &.answer-text {
201
  padding-left: 5px;
202
  }
72
  & > .order {
73
  flex: 0 0 30px;
74
  text-align: right;
 
75
  font-size: 15px;
76
  padding: 12px 0;
77
  &:after {
175
  tr {
176
  background: #fff;
177
  border: 1px solid #DDD;
 
178
  &:nth-child(2n) {
179
  background: #f4fcff;
180
  }
186
  &.sort {
187
  cursor: url("../../images/openhand.cur") 7 5, default;
188
  width: 12px;
 
189
 
190
  }
 
 
 
 
 
 
191
  &.answer-text {
192
  padding-left: 5px;
193
  }
assets/scss/admin/admin.scss CHANGED
@@ -50,6 +50,18 @@
50
 
51
  .lp-notice-update-database {
52
  border-left-color: #FF0000;
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
54
 
55
  #adminmenu {
50
 
51
  .lp-notice-update-database {
52
  border-left-color: #FF0000;
53
+ &.do-updating {
54
+ &:before {
55
+ display: inline-block;
56
+ content: "\f463";
57
+ font-family: dashicons;
58
+ font-size: 20px;
59
+ float: left;
60
+ margin: 9px 5px 0 -5px;
61
+ color: #2773aa;
62
+ @include rotating4();
63
+ }
64
+ }
65
  }
66
 
67
  #adminmenu {
assets/scss/frontend/_curriculum.scss CHANGED
@@ -617,93 +617,6 @@ body {
617
  }
618
  }
619
 
620
- .question-numbers {
621
- list-style: none;
622
- text-align: center;
623
- li {
624
- display: inline-block;
625
- a {
626
- display: block;
627
- padding: 8px;
628
- background: #F5F5F5;
629
- line-height: 1;
630
- color: #999;
631
- border: 1px solid #DDD;
632
- font-size: 12px;
633
- min-width: 20px;
634
- box-shadow: none;
635
- span {
636
- vertical-align: middle;
637
- }
638
- &:hover {
639
- background: #00adff;
640
- color: #FFF;
641
- border: 1px solid #3880a2;
642
- }
643
- }
644
- &.current {
645
- a {
646
- background: #00adff;
647
- color: #FFF !important;
648
- border-color: #3880a2;
649
- }
650
- }
651
- &.answered {
652
- a {
653
- &:after {
654
- font-family: fontawesome;
655
- font-size: 8px;
656
- vertical-align: middle;
657
- margin-left: 3px;
658
- }
659
- }
660
- &.answered-wrong {
661
- a {
662
- color: #FF0000;
663
- &:after {
664
- //content: "\f05e";
665
- }
666
- }
667
- }
668
- &.answered-true {
669
- a {
670
- color: #00adff;
671
- &:after {
672
- //content: "\f00c";
673
- }
674
- }
675
- &.current {
676
- a {
677
- color: #FFF;
678
- }
679
- }
680
- }
681
- }
682
- }
683
- }
684
-
685
- .quiz-intro {
686
- list-style: none;
687
- margin: 0 0 20px;
688
- padding: 0;
689
- display: table;
690
- li {
691
- margin: 0;
692
- display: table-row;
693
- label, span {
694
- display: table-cell;
695
- }
696
- label {
697
- font-weight: bold;
698
- padding: 0 20px 10px 0px;
699
- line-height: 1;
700
- }
701
- span {
702
- text-align: left;
703
- }
704
- }
705
- }
706
-
707
  .course-remaining-time {
708
  .lp-label {
709
  &.label-enrolled {
617
  }
618
  }
619
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
620
  .course-remaining-time {
621
  .lp-label {
622
  &.label-enrolled {
assets/scss/frontend/_quiz.scss CHANGED
@@ -155,12 +155,15 @@
155
  border-radius: 50%;
156
  }
157
  }
 
158
  .option-title {
159
  margin: 0;
160
  }
 
161
  &:hover {
162
  background: #e1f5ff;
163
  }
 
164
  &.answer-correct {
165
  background: #e1f5ff;
166
  input[type="radio"]:checked,
@@ -189,33 +192,40 @@
189
  input[type="checkbox"] {
190
  &:before,
191
  &:after {
192
- position: absolute;
193
- background: #FF0000;
194
- border: none;
195
- content: '';
196
- display: inline-block;
197
- left: 50%;
198
- top: 50%;
199
- @include border-radius(2px);
200
- @include transform(rotate(-45deg));
201
- }
202
-
203
- &:before {
204
- width: 2px;
205
- height: 18px;
206
- margin-top: -9px;
207
- margin-left: -1px;
208
- }
209
-
210
- &:after {
211
- width: 18px;
212
- height: 2px;
213
- margin-top: -1px;
214
- margin-left: -9px;
215
- border: none;
216
- opacity: 1;
217
  }
218
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
 
220
  input[type="radio"]:checked,
221
  input[type="checkbox"]:checked {
@@ -318,6 +328,113 @@ button[data-counter] {
318
  }
319
  }
320
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
  .question-explanation-content,
322
  .question-hint-content {
323
  margin-bottom: 20px;
155
  border-radius: 50%;
156
  }
157
  }
158
+
159
  .option-title {
160
  margin: 0;
161
  }
162
+
163
  &:hover {
164
  background: #e1f5ff;
165
  }
166
+
167
  &.answer-correct {
168
  background: #e1f5ff;
169
  input[type="radio"]:checked,
192
  input[type="checkbox"] {
193
  &:before,
194
  &:after {
195
+ border-color: #FF0000;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  }
197
  }
198
+ //input[type="radio"],
199
+ //input[type="checkbox"] {
200
+ // &:before,
201
+ // &:after {
202
+ // position: absolute;
203
+ // _background: #FF0000;
204
+ // border: none;
205
+ // content: '';
206
+ // display: inline-block;
207
+ // left: 50%;
208
+ // top: 50%;
209
+ // @include border-radius(2px);
210
+ // @include transform(rotate(-45deg));
211
+ // }
212
+ //
213
+ // &:before {
214
+ // width: 2px;
215
+ // height: 18px;
216
+ // margin-top: -9px;
217
+ // margin-left: -1px;
218
+ // }
219
+ //
220
+ // &:after {
221
+ // width: 18px;
222
+ // height: 2px;
223
+ // margin-top: -1px;
224
+ // margin-left: -9px;
225
+ // border: none;
226
+ // opacity: 1;
227
+ // }
228
+ //}
229
 
230
  input[type="radio"]:checked,
231
  input[type="checkbox"]:checked {
328
  }
329
  }
330
 
331
+ .question-numbers {
332
+ list-style: none;
333
+ text-align: center;
334
+ li {
335
+ display: inline-block;
336
+ position: relative;
337
+ margin-bottom: 3px;
338
+ a {
339
+ display: block;
340
+ padding: 8px;
341
+ background: #F5F5F5;
342
+ line-height: 1;
343
+ color: #999;
344
+ border: 1px solid #DDD;
345
+ font-size: 12px;
346
+ min-width: 20px;
347
+ box-shadow: none;
348
+ span {
349
+ vertical-align: middle;
350
+ }
351
+ &:hover {
352
+ background: #00adff;
353
+ color: #FFF;
354
+ border: 1px solid #3880a2;
355
+ }
356
+ }
357
+ &.current {
358
+ a {
359
+ background: #00adff;
360
+ color: #FFF !important;
361
+ border-color: #3880a2;
362
+ }
363
+ &.skipped {
364
+ &:after {
365
+ background: #FFF;
366
+ }
367
+ }
368
+ }
369
+ &.answered {
370
+ a {
371
+ &:after {
372
+ font-family: fontawesome;
373
+ font-size: 8px;
374
+ vertical-align: middle;
375
+ margin-left: 3px;
376
+ }
377
+ }
378
+ &.answered-wrong {
379
+ a {
380
+ color: #FF0000;
381
+ &:after {
382
+ //content: "\f05e";
383
+ }
384
+ }
385
+ }
386
+ &.answered-true {
387
+ a {
388
+ color: #00adff;
389
+ &:after {
390
+ //content: "\f00c";
391
+ }
392
+ }
393
+ &.current {
394
+ a {
395
+ color: #FFF;
396
+ }
397
+ }
398
+ }
399
+ }
400
+ &.skipped {
401
+ &:after {
402
+ content: '';
403
+ background: #AAA;
404
+ width: 10px;
405
+ height: 4px;
406
+ position: absolute;
407
+ border-radius: 2px;
408
+ left: 50%;
409
+ margin-left: -5px;
410
+ bottom: 3px;
411
+ }
412
+ }
413
+ }
414
+ }
415
+
416
+ .quiz-intro {
417
+ list-style: none;
418
+ margin: 0 0 20px;
419
+ padding: 0;
420
+ display: table;
421
+ li {
422
+ margin: 0;
423
+ display: table-row;
424
+ label, span {
425
+ display: table-cell;
426
+ }
427
+ label {
428
+ font-weight: bold;
429
+ padding: 0 20px 10px 0px;
430
+ line-height: 1;
431
+ }
432
+ span {
433
+ text-align: left;
434
+ }
435
+ }
436
+ }
437
+
438
  .question-explanation-content,
439
  .question-hint-content {
440
  margin-bottom: 20px;
inc/abstract-settings.php CHANGED
@@ -10,6 +10,16 @@ abstract class LP_Abstract_Settings {
10
  */
11
  public function __construct() {
12
  // TODO: init anything here
 
 
 
 
 
 
 
 
 
 
13
  }
14
 
15
  /**
10
  */
11
  public function __construct() {
12
  // TODO: init anything here
13
+ add_filter( 'learn-press/update-settings/redirect', array( $this, '_do_save' ) );
14
+ }
15
+
16
+ public function _do_save($url) {
17
+ $this->save();
18
+ return $url;
19
+ }
20
+
21
+ public function save() {
22
+ // This function should be overwritten from it's child
23
  }
24
 
25
  /**
inc/abstracts/abstract-background-process.php CHANGED
@@ -41,8 +41,13 @@ if ( ! class_exists( 'LP_Abstract_Background_Process' ) ) {
41
  */
42
  public function __construct() {
43
  parent::__construct();
44
-
45
- add_action( 'shutdown', array( $this, 'dispatch_queue' ) );
 
 
 
 
 
46
  }
47
 
48
  /**
@@ -72,10 +77,9 @@ if ( ! class_exists( 'LP_Abstract_Background_Process' ) ) {
72
  /**
73
  * @param mixed $data
74
  *
75
- * @return $this
76
  */
77
  public function push_to_queue( $data ) {
78
-
79
  // Check to preventing loop
80
  if ( $this->safe ) {
81
  if ( learn_press_is_ajax() || ! empty( $_REQUEST['action'] ) ) {
@@ -96,6 +100,12 @@ if ( ! class_exists( 'LP_Abstract_Background_Process' ) ) {
96
  }
97
 
98
  protected function task( $item ) {
 
 
 
 
 
 
99
  }
100
 
101
  /**
41
  */
42
  public function __construct() {
43
  parent::__construct();
44
+ /**
45
+ * Priority is important that will fix issue with WC cart doesnt remove
46
+ * after completing checkout and get order details
47
+ *
48
+ * @since 3.0.8
49
+ */
50
+ add_action( 'shutdown', array( $this, 'dispatch_queue' ), 1000 );
51
  }
52
 
53
  /**
77
  /**
78
  * @param mixed $data
79
  *
80
+ * @return mixed
81
  */
82
  public function push_to_queue( $data ) {
 
83
  // Check to preventing loop
84
  if ( $this->safe ) {
85
  if ( learn_press_is_ajax() || ! empty( $_REQUEST['action'] ) ) {
100
  }
101
 
102
  protected function task( $item ) {
103
+ ob_start();
104
+ print_r( $item );
105
+ print_r( $_REQUEST );
106
+ $msg = ob_get_clean();
107
+ LP_Debug::instance()->add( $msg, 'background-process-task', false, true );
108
+ return false;
109
  }
110
 
111
  /**
inc/admin/class-lp-admin-dashboard.php CHANGED
@@ -100,7 +100,7 @@ if ( ! class_exists( 'LP_Admin_Dashboard' ) ) {
100
  if ( $orders ) {
101
  foreach ( $orders as $order ) {
102
  $order = learn_press_get_order( $order->ID );
103
- $total = $total + floatval($order->order_total);
104
  }
105
  }
106
 
@@ -193,7 +193,7 @@ if ( ! class_exists( 'LP_Admin_Dashboard' ) ) {
193
  */
194
  public function plugin_status() {
195
  $plugin_data = $this->_get_data();
196
- if ( ! $plugin_data ) {
197
  learn_press_admin_view( 'dashboard/plugin-status/html-no-data' );
198
  } else {
199
  learn_press_admin_view( 'dashboard/plugin-status/html-results', array( 'plugin_data' => $plugin_data ) );
100
  if ( $orders ) {
101
  foreach ( $orders as $order ) {
102
  $order = learn_press_get_order( $order->ID );
103
+ $total = $total + floatval( $order->order_total );
104
  }
105
  }
106
 
193
  */
194
  public function plugin_status() {
195
  $plugin_data = $this->_get_data();
196
+ if ( ! $plugin_data || is_wp_error( $plugin_data ) ) {
197
  learn_press_admin_view( 'dashboard/plugin-status/html-no-data' );
198
  } else {
199
  learn_press_admin_view( 'dashboard/plugin-status/html-results', array( 'plugin_data' => $plugin_data ) );
inc/admin/class-lp-admin-menu.php CHANGED
@@ -137,8 +137,6 @@ class LP_Admin_Menu {
137
  }
138
 
139
  $addons = LP_Admin::instance()->get_addons();
140
-
141
- add_submenu_page( 'plugins.php', '', __( 'LearnPress', 'learnpress' ), 'manage_options', 'plugins.php?s=learnpress' );
142
  }
143
 
144
  /**
137
  }
138
 
139
  $addons = LP_Admin::instance()->get_addons();
 
 
140
  }
141
 
142
  /**
inc/admin/class-lp-admin.php CHANGED
@@ -474,6 +474,10 @@ if ( ! class_exists( 'LP_Admin' ) ) {
474
  }
475
  echo '<div class="updated notice">' . __( 'User has accepted to become a teacher.', 'learnpress' ) . '</div>';
476
  }
 
 
 
 
477
  }
478
 
479
  /**
474
  }
475
  echo '<div class="updated notice">' . __( 'User has accepted to become a teacher.', 'learnpress' ) . '</div>';
476
  }
477
+
478
+ if ( LP()->session->get( 'do-update-learnpress' ) ) {
479
+ learn_press_admin_view( 'updates/html-updated-latest-message' );
480
+ }
481
  }
482
 
483
  /**
inc/admin/class-lp-reset-data.php CHANGED
@@ -37,10 +37,13 @@ class LP_Reset_Data {
37
  if ( ! is_numeric( $user_id ) ) {
38
  if ( $user = get_user_by( 'email', $user_id ) ) {
39
  $user_id = $user->ID;
 
 
40
  }
41
  }
42
  global $wpdb;
43
 
 
44
  $query = $wpdb->prepare( "
45
  SELECT user_item_id
46
  FROM {$wpdb->learnpress_user_items}
@@ -48,6 +51,12 @@ class LP_Reset_Data {
48
  ", $user_id, $item_id );
49
 
50
  if ( $user_item_ids = $wpdb->get_col( $query ) ) {
 
 
 
 
 
 
51
 
52
  $format = array_fill( 0, sizeof( $user_item_ids ), '%d' );
53
  $query = $wpdb->prepare( "
@@ -65,13 +74,31 @@ class LP_Reset_Data {
65
 
66
  $wpdb->query( $query );
67
 
68
- echo __( 'Data deleted', 'learnpress' );
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  } else {
70
  echo __( 'No data found', 'learnpress' );
71
  }
 
72
  die();
73
  }
74
 
 
 
 
 
75
  public static function search_courses() {
76
  global $wpdb;
77
 
@@ -190,7 +217,6 @@ class LP_Reset_Data {
190
  $course_id = LP_Request::get_int( 'course_id' );
191
 
192
  global $wpdb;
193
-
194
  if ( $course_id ) {
195
 
196
  self::reset_course_users( $course_id, $user_id );
@@ -220,7 +246,6 @@ class LP_Reset_Data {
220
  $wpdb->query( $query );
221
  }
222
  }
223
-
224
  die();
225
  }
226
 
@@ -231,7 +256,7 @@ class LP_Reset_Data {
231
  return false;
232
  }
233
 
234
- LP_Debug::startTransaction();
235
 
236
  try {
237
  // Delete course items
@@ -249,7 +274,7 @@ class LP_Reset_Data {
249
  self::delete_user_items_by_id( $user_item_ids );
250
  }
251
  catch ( Exception $ex ) {
252
- LP_Debug::rollbackTransaction();
253
  }
254
 
255
  $removed = false;
@@ -257,7 +282,7 @@ class LP_Reset_Data {
257
  $removed = $course_id;
258
  }
259
 
260
- LP_Debug::commitTransaction();
261
 
262
  return $removed;
263
  }
37
  if ( ! is_numeric( $user_id ) ) {
38
  if ( $user = get_user_by( 'email', $user_id ) ) {
39
  $user_id = $user->ID;
40
+ } elseif ( $user = get_user_by( 'login', $user_id ) ) {
41
+ $user_id = $user->ID;
42
  }
43
  }
44
  global $wpdb;
45
 
46
+ //LP_Debug::startTransaction();
47
  $query = $wpdb->prepare( "
48
  SELECT user_item_id
49
  FROM {$wpdb->learnpress_user_items}
51
  ", $user_id, $item_id );
52
 
53
  if ( $user_item_ids = $wpdb->get_col( $query ) ) {
54
+ $query = "
55
+ SELECT DISTINCT parent_id AS parent, item_id
56
+ FROM {$wpdb->learnpress_user_items}
57
+ WHERE user_item_id IN(" . join( ',', $user_item_ids ) . ")
58
+ ";
59
+ $parents = $wpdb->get_results( $query );
60
 
61
  $format = array_fill( 0, sizeof( $user_item_ids ), '%d' );
62
  $query = $wpdb->prepare( "
74
 
75
  $wpdb->query( $query );
76
 
77
+ if ( $parents ) {
78
+ foreach ( $parents as $parent ) {
79
+ if ( $retaken_items = learn_press_get_user_item_meta( $parent->parent, '_retaken_items', true ) ) {
80
+ if ( !isset( $retaken_items[ $parent->item_id ] ) ) {
81
+ continue;
82
+ }
83
+
84
+ unset( $retaken_items[ $parent->item_id ] );
85
+ learn_press_update_user_item_meta( $parent->parent, '_retaken_items', $retaken_items );
86
+ }
87
+ }
88
+ }
89
+
90
+ echo __( 'Item progress deleted', 'learnpress' );
91
  } else {
92
  echo __( 'No data found', 'learnpress' );
93
  }
94
+ //LP_Debug::rollbackTransaction();
95
  die();
96
  }
97
 
98
+ public static function remove_item_data() {
99
+
100
+ }
101
+
102
  public static function search_courses() {
103
  global $wpdb;
104
 
217
  $course_id = LP_Request::get_int( 'course_id' );
218
 
219
  global $wpdb;
 
220
  if ( $course_id ) {
221
 
222
  self::reset_course_users( $course_id, $user_id );
246
  $wpdb->query( $query );
247
  }
248
  }
 
249
  die();
250
  }
251
 
256
  return false;
257
  }
258
 
259
+ //LP_Debug::startTransaction();
260
 
261
  try {
262
  // Delete course items
274
  self::delete_user_items_by_id( $user_item_ids );
275
  }
276
  catch ( Exception $ex ) {
277
+ //LP_Debug::rollbackTransaction();
278
  }
279
 
280
  $removed = false;
282
  $removed = $course_id;
283
  }
284
 
285
+ //LP_Debug::commitTransaction();
286
 
287
  return $removed;
288
  }
inc/admin/class-lp-updater.php CHANGED
@@ -25,47 +25,91 @@ class LP_Updater {
25
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
26
  add_action( 'admin_init', array( $this, 'update_form' ) );
27
  add_action( 'admin_init', array( $this, 'do_update' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
29
 
30
  public function do_update() {
 
 
 
 
 
31
  if ( 'yes' !== LP_Request::get_string( 'do-update-learnpress' ) ) {
32
- return;
33
  }
34
- echo '<div>';
35
- //ob_start();
 
 
 
 
 
 
 
 
 
 
 
36
  try {
37
- LP_Debug::startTransaction();
 
 
38
  foreach ( $this->get_update_files() as $version => $file ) {
39
- $file = LP_PLUGIN_PATH . '/inc/updates/' . $file;
40
 
41
- include_once $file;
 
 
42
 
43
- echo sprintf( __( "<p>Updated version %s</p>", 'learnpress' ), $version ) . "\n";
 
 
 
 
44
  }
45
 
46
- LP_Install::update_version();
47
- LP_Install::update_db_version();
 
 
 
 
 
48
  }
49
  catch ( Exception $ex ) {
50
  learn_press_add_message( $ex->getMessage(), 'error' );
51
  }
52
 
53
- if ( ob_get_length() ) {
54
- ob_get_clean();
55
- }
56
-
57
- if ( ! learn_press_message_count() ) {
58
- LP_Debug::commitTransaction();
59
- echo '<div id="message-success">';
60
- learn_press_display_message( __( 'Successfully updated your database.', 'learnpress' ) );
61
- echo '</div>';
62
- } else {
63
- LP_Debug::rollbackTransaction();
64
-
65
- learn_press_print_messages();
66
- }
67
- echo '</div>';
68
- die();
69
  }
70
 
71
  /**
@@ -88,6 +132,22 @@ class LP_Updater {
88
  }
89
  }
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  /**
92
  * Scan folder updates to get update patches.
93
  */
25
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
26
  add_action( 'admin_init', array( $this, 'update_form' ) );
27
  add_action( 'admin_init', array( $this, 'do_update' ) );
28
+
29
+ if ( 'yes' === get_option( 'do-update-learnpress' ) ) {
30
+ add_action( 'admin_notices', array( $this, 'update_message' ), 10 );
31
+ }
32
+
33
+ LP_Request::register_ajax( 'check-updated', array( $this, 'check_updated' ) );
34
+ }
35
+
36
+ public function check_updated() {
37
+
38
+ $this->do_update();
39
+ $db_version = get_option( 'learnpress_db_version' );
40
+ $latest_version = $this->get_latest_version();
41
+ $response = array(
42
+ 'result' => 'error'
43
+ );
44
+
45
+ if ( version_compare( $db_version, $latest_version, '>=' ) ) {
46
+ $response['result'] = 'success';
47
+ $response['message'] = learn_press_admin_view_content( 'updates/html-updated-latest-message' );
48
+ } else {
49
+ $response['step'] = get_option( 'learnpress_updater_step' );
50
+ }
51
+
52
+ learn_press_send_json( $response );
53
+ die();
54
+ }
55
+
56
+ public function update_message() {
57
+ remove_action( 'admin_notices', array( 'LP_Install', 'check_update_message' ), 20 );
58
+ learn_press_admin_view( 'updates/html-updating-message' );
59
  }
60
 
61
  public function do_update() {
62
+
63
+ if ( 'yes' === get_option( 'do-update-learnpress' ) ) {
64
+ return $this->_do_update();
65
+ }
66
+
67
  if ( 'yes' !== LP_Request::get_string( 'do-update-learnpress' ) ) {
68
+ return false;
69
  }
70
+
71
+ update_option( 'do-update-learnpress', 'yes', 'yes' );
72
+
73
+ if ( ! learn_press_message_count() ) {
74
+ $this->update_message();
75
+ } else {
76
+ learn_press_print_messages();
77
+ }
78
+ die();
79
+ }
80
+
81
+ protected function _do_update() {
82
+
83
  try {
84
+ $db_version = get_option( 'learnpress_db_version' );
85
+ $latest_version = true;
86
+
87
  foreach ( $this->get_update_files() as $version => $file ) {
 
88
 
89
+ if ( $db_version && version_compare( $db_version, $version, '>=' ) ) {
90
+ continue;
91
+ }
92
 
93
+ $file = LP_PLUGIN_PATH . '/inc/updates/' . $file;
94
+ include_once $file;
95
+ update_option( 'learnpress_updater', $version, 'yes' );
96
+ $latest_version = false;
97
+ break;
98
  }
99
 
100
+ if ( $latest_version ) {
101
+ delete_option( 'do-update-learnpress' );
102
+ delete_option( 'learnpress_updater' );
103
+ LP_Install::update_version();
104
+ remove_action( 'admin_notices', array( $this, 'update_message' ), 10 );
105
+ LP()->session->set( 'do-update-learnpress', 'yes' );
106
+ }
107
  }
108
  catch ( Exception $ex ) {
109
  learn_press_add_message( $ex->getMessage(), 'error' );
110
  }
111
 
112
+ return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  }
114
 
115
  /**
132
  }
133
  }
134
 
135
+ /**
136
+ * Get latest version from updates
137
+ *
138
+ * @return bool|mixed
139
+ */
140
+ public function get_latest_version() {
141
+ if ( ! $this->get_update_files() ) {
142
+ return false;
143
+ }
144
+
145
+ $versions = array_keys( $this->_update_files );
146
+ $latest_version = end( $versions );
147
+
148
+ return $latest_version;
149
+ }
150
+
151
  /**
152
  * Scan folder updates to get update patches.
153
  */
inc/admin/editor/class-lp-admin-editor.php CHANGED
@@ -47,6 +47,8 @@ class LP_Admin_Editor {
47
  $func = str_replace( '-', '_', $type );
48
  $callback = array( $this, $func );
49
  if ( is_callable( $callback ) ) {
 
 
50
  return call_user_func_array( $callback, $args );
51
  }
52
 
47
  $func = str_replace( '-', '_', $type );
48
  $callback = array( $this, $func );
49
  if ( is_callable( $callback ) ) {
50
+ LP_Hard_Cache::flush();
51
+
52
  return call_user_func_array( $callback, $args );
53
  }
54
 
inc/admin/helpers/class-lp-plugins-helper.php CHANGED
@@ -140,7 +140,7 @@ class LP_Plugins_Helper {
140
  public static function get_plugins_from_wp( $args = null ) {
141
 
142
  if ( ! ( $plugins = get_transient( 'lp_plugins_wp' ) ) ) {
143
- self::$_background_query_items->push_to_queue(
144
  array(
145
  'callback' => array( 'LP_Background_Query_Items', 'query_free_addons' )
146
  )
@@ -160,7 +160,7 @@ class LP_Plugins_Helper {
160
  public static function get_premium_plugins() {
161
 
162
  if ( ! ( $plugins = get_transient( 'lp_plugins_tp' ) ) ) {
163
- self::$_background_query_items->push_to_queue(
164
  array(
165
  'callback' => array( 'LP_Background_Query_Items', 'query_premium_addons' )
166
  )
@@ -183,7 +183,7 @@ class LP_Plugins_Helper {
183
  self::$themes = get_transient( 'lp_related_themes' );
184
 
185
  if ( ! self::$themes ) {
186
- self::$_background_query_items->push_to_queue(
187
  array(
188
  'callback' => array( 'LP_Background_Query_Items', 'get_related_themes' )
189
  )
@@ -426,9 +426,9 @@ class LP_Plugins_Helper {
426
  require_once( LP_PLUGIN_PATH . '/inc/admin/class-lp-upgrader.php' );
427
  add_filter( 'extra_plugin_headers', array( __CLASS__, 'add_on_header' ) );
428
 
429
- if ( ! is_a( self::$_background_query_items, 'LP_Background_Query_Addons' ) ) {
430
- self::$_background_query_items = new LP_Background_Query_Items();
431
- }
432
  }
433
  }
434
 
140
  public static function get_plugins_from_wp( $args = null ) {
141
 
142
  if ( ! ( $plugins = get_transient( 'lp_plugins_wp' ) ) ) {
143
+ LP()->background('query-items')->push_to_queue(
144
  array(
145
  'callback' => array( 'LP_Background_Query_Items', 'query_free_addons' )
146
  )
160
  public static function get_premium_plugins() {
161
 
162
  if ( ! ( $plugins = get_transient( 'lp_plugins_tp' ) ) ) {
163
+ LP()->background('query-items')->push_to_queue(
164
  array(
165
  'callback' => array( 'LP_Background_Query_Items', 'query_premium_addons' )
166
  )
183
  self::$themes = get_transient( 'lp_related_themes' );
184
 
185
  if ( ! self::$themes ) {
186
+ LP()->background('query-items')->push_to_queue(
187
  array(
188
  'callback' => array( 'LP_Background_Query_Items', 'get_related_themes' )
189
  )
426
  require_once( LP_PLUGIN_PATH . '/inc/admin/class-lp-upgrader.php' );
427
  add_filter( 'extra_plugin_headers', array( __CLASS__, 'add_on_header' ) );
428
 
429
+ // if ( ! is_a( self::$_background_query_items, 'LP_Background_Query_Addons' ) ) {
430
+ // self::$_background_query_items = new LP_Background_Query_Items();
431
+ // }
432
  }
433
  }
434
 
inc/admin/lp-admin-functions.php CHANGED
@@ -135,7 +135,7 @@ function learn_press_admin_view_content( $name, $args = array() ) {
135
  * Find a full path of a view and display the content in admin
136
  *
137
  * @param $name
138
- * @param array $args
139
  * @param bool|false $include_once
140
  * @param bool
141
  *
@@ -171,7 +171,7 @@ function learn_press_admin_view( $name, $args = array(), $include_once = false,
171
  *
172
  * @param $name
173
  * @param bool|false $selected
174
- * @param array $args
175
  *
176
  * @return mixed|string
177
  */
@@ -360,24 +360,41 @@ function learn_press_field_question_duration( $args = array(), $question ) {
360
  * @return string
361
  */
362
  function learn_press_email_formats_dropdown( $args = array() ) {
363
- $args = wp_parse_args(
364
  $args,
365
  array(
366
- 'name' => 'learn-press-dropdown-email-formats',
367
- 'id' => '',
368
- 'class' => '',
369
- 'selected' => '',
370
- 'echo' => true
 
371
  )
372
  );
 
373
  $formats = array(
374
  'plain_text' => __( 'Plain text', 'learnpress' ),
375
  'html' => __( 'HTML', 'learnpress' ),
376
  );
 
377
  if ( empty( $args['id'] ) ) {
378
  $args['id'] = sanitize_file_name( $args['name'] );
379
  }
 
380
  $output = sprintf( '<select name="%s" id="%s" class="%s" %s>', $args['name'], $args['id'], $args['class'], '' );
 
 
 
 
 
 
 
 
 
 
 
 
 
381
  foreach ( $formats as $name => $text ) {
382
  $output .= sprintf( '<option value="%s" %s>%s</option>', $name, selected( $args['selected'] == $name, true, false ), $text ) . "\n";
383
  }
@@ -1674,9 +1691,9 @@ if ( ! function_exists( 'learn_press_duplicate_post' ) ) {
1674
  *
1675
  * @since 3.0.0
1676
  *
1677
- * @param null $post_id
1678
  * @param array $args
1679
- * @param bool $meta
1680
  *
1681
  * @return bool|mixed
1682
  */
@@ -2186,7 +2203,7 @@ function learn_press_touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $mult
2186
  * @since 3.0.4
2187
  *
2188
  * @param int|string $context_id
2189
- * @param string $context
2190
  *
2191
  * @return bool|int|string
2192
  */
@@ -2205,7 +2222,7 @@ add_filter( 'learn-press/modal-search-items/context-id', 'learn_press_modal_sear
2205
  *
2206
  * @since 3.0.0
2207
  *
2208
- * @param string $link
2209
  * @param WP_Post $post
2210
  *
2211
  * @return string
135
  * Find a full path of a view and display the content in admin
136
  *
137
  * @param $name
138
+ * @param array $args
139
  * @param bool|false $include_once
140
  * @param bool
141
  *
171
  *
172
  * @param $name
173
  * @param bool|false $selected
174
+ * @param array $args
175
  *
176
  * @return mixed|string
177
  */
360
  * @return string
361
  */
362
  function learn_press_email_formats_dropdown( $args = array() ) {
363
+ $args = wp_parse_args(
364
  $args,
365
  array(
366
+ 'name' => 'learn-press-dropdown-email-formats',
367
+ 'id' => '',
368
+ 'class' => '',
369
+ 'selected' => '',
370
+ 'option_none' => '',
371
+ 'echo' => true
372
  )
373
  );
374
+
375
  $formats = array(
376
  'plain_text' => __( 'Plain text', 'learnpress' ),
377
  'html' => __( 'HTML', 'learnpress' ),
378
  );
379
+
380
  if ( empty( $args['id'] ) ) {
381
  $args['id'] = sanitize_file_name( $args['name'] );
382
  }
383
+
384
  $output = sprintf( '<select name="%s" id="%s" class="%s" %s>', $args['name'], $args['id'], $args['class'], '' );
385
+
386
+ if ( $args['option_none'] ) {
387
+ if ( is_array( $args['option_none'] ) ) {
388
+ $text = reset( $args['option_none'] );
389
+ $value = key( $args['option_none'] );
390
+ } else {
391
+ $text = $args['option_none'];
392
+ $value = '';
393
+ }
394
+
395
+ $output .= sprintf( '<option value="%s">%s</option>', $value, $text );
396
+ }
397
+
398
  foreach ( $formats as $name => $text ) {
399
  $output .= sprintf( '<option value="%s" %s>%s</option>', $name, selected( $args['selected'] == $name, true, false ), $text ) . "\n";
400
  }
1691
  *
1692
  * @since 3.0.0
1693
  *
1694
+ * @param null $post_id
1695
  * @param array $args
1696
+ * @param bool $meta
1697
  *
1698
  * @return bool|mixed
1699
  */
2203
  * @since 3.0.4
2204
  *
2205
  * @param int|string $context_id
2206
+ * @param string $context
2207
  *
2208
  * @return bool|int|string
2209
  */
2222
  *
2223
  * @since 3.0.0
2224
  *
2225
+ * @param string $link
2226
  * @param WP_Post $post
2227
  *
2228
  * @return string
inc/admin/meta-box/fields/course-permalink.php CHANGED
@@ -1,6 +1,20 @@
1
  <?php
2
 
 
 
 
 
 
3
  class RWMB_Course_Permalink_Field extends RWMB_Field {
 
 
 
 
 
 
 
 
 
4
  public static function html( $meta, $field ) {
5
  $meta = self::sanitize_meta( $meta );
6
  // default value
@@ -22,12 +36,6 @@ class RWMB_Course_Permalink_Field extends RWMB_Field {
22
  $base_slug = urldecode( ( $courses_page_id > 0 && get_post( $courses_page_id ) ) ? get_page_uri( $courses_page_id ) : _x( 'courses', 'default-slug', 'learnpress' ) );
23
  $course_base = _x( 'course', 'default-slug', 'learnpress' );
24
 
25
- /*if ( !$course_permalink ) {
26
- global $wpdb;
27
- if ( $wpdb->get_results( $wpdb->prepare( "SELECT count(option_id) FROM {$wpdb->options} WHERE option_name = %s", 'learn_press_course_base' ) ) == 0 ) {
28
- //$course_permalink = '/courses';
29
- }
30
- }*/
31
  $structures = array(
32
  0 => array(
33
  'value' => '',
@@ -54,9 +62,9 @@ class RWMB_Course_Permalink_Field extends RWMB_Field {
54
  $base_type = get_option( 'learn_press_course_base_type' );
55
  $is_custom = ( $base_type == 'custom' && $course_permalink != '' );
56
  ?>
57
- <ul>
58
  <?php foreach ( $structures as $k => $structure ): ?>
59
- <li class="learn-press-single-course-permalink<?php if ( $k == 2 || $k == 3 ) {
60
  echo ' learn-press-courses-page-id';
61
  echo ! $courses_page_id ? ' hide-if-js' : '';
62
  }; ?>">
@@ -67,31 +75,31 @@ class RWMB_Course_Permalink_Field extends RWMB_Field {
67
  $is_custom = false;
68
  }
69
  ?>
70
- <label>
71
- <input name="<?php echo $field['id']; ?>" type="radio"
72
- value="<?php echo esc_attr( $structure['value'] ); ?>"
73
- class="learn-press-course-base" <?php echo $is_checked; ?> />
74
  <?php echo $structure['text']; ?>
75
- <p><code><?php echo $structure['code']; ?></code></p>
76
- </label>
77
- </li>
78
  <?php endforeach; ?>
79
- <li class="learn-press-single-course-permalink custom-base">
80
- <label>
81
- <input name="<?php echo $field['id']; ?>"
82
- id="learn_press_custom_permalink" type="radio"
83
- value="custom" <?php checked( $is_custom, true ); ?> />
84
  <?php _e( 'Custom Base', 'learnpress' ); ?>
85
- <input name="course_permalink_structure" id="course_permalink_structure" <?php if ( ! $is_custom ) {
86
  echo 'readonly="readonly"';
87
  } ?> type="text" value="<?php if ( $course_permalink ) {
88
  echo esc_attr( trailingslashit( $course_permalink ) );
89
  } ?>" class="regular-text code"/>
90
- </label>
91
 
92
- <p class="description"><?php _e( 'Enter a custom base to use. A base <strong>must</strong> be set or WordPress will use default values instead.', 'learnpress' ); ?></p>
93
- </li>
94
- </ul>
95
  <?php
96
  return ob_get_clean();
97
  }
1
  <?php
2
 
3
+ /**
4
+ * Class RWMB_Course_Permalink_Field
5
+ *
6
+ * @extend RWMB_Field
7
+ */
8
  class RWMB_Course_Permalink_Field extends RWMB_Field {
9
+
10
+ /**
11
+ * Show field.
12
+ *
13
+ * @param mixed $meta
14
+ * @param array $field
15
+ *
16
+ * @return string
17
+ */
18
  public static function html( $meta, $field ) {
19
  $meta = self::sanitize_meta( $meta );
20
  // default value
36
  $base_slug = urldecode( ( $courses_page_id > 0 && get_post( $courses_page_id ) ) ? get_page_uri( $courses_page_id ) : _x( 'courses', 'default-slug', 'learnpress' ) );
37
  $course_base = _x( 'course', 'default-slug', 'learnpress' );
38
 
 
 
 
 
 
 
39
  $structures = array(
40
  0 => array(
41
  'value' => '',
62
  $base_type = get_option( 'learn_press_course_base_type' );
63
  $is_custom = ( $base_type == 'custom' && $course_permalink != '' );
64
  ?>
65
+ <ul>
66
  <?php foreach ( $structures as $k => $structure ): ?>
67
+ <li class="learn-press-single-course-permalink<?php if ( $k == 2 || $k == 3 ) {
68
  echo ' learn-press-courses-page-id';
69
  echo ! $courses_page_id ? ' hide-if-js' : '';
70
  }; ?>">
75
  $is_custom = false;
76
  }
77
  ?>
78
+ <label>
79
+ <input name="<?php echo $field['id']; ?>" type="radio"
80
+ value="<?php echo esc_attr( $structure['value'] ); ?>"
81
+ class="learn-press-course-base" <?php echo $is_checked; ?> />
82
  <?php echo $structure['text']; ?>
83
+ <p><code><?php echo $structure['code']; ?></code></p>
84
+ </label>
85
+ </li>
86
  <?php endforeach; ?>
87
+ <li class="learn-press-single-course-permalink custom-base">
88
+ <label>
89
+ <input name="<?php echo $field['id']; ?>"
90
+ id="learn_press_custom_permalink" type="radio"
91
+ value="custom" <?php checked( $is_custom, true ); ?> />
92
  <?php _e( 'Custom Base', 'learnpress' ); ?>
93
+ <input name="course_permalink_structure" id="course_permalink_structure" <?php if ( ! $is_custom ) {
94
  echo 'readonly="readonly"';
95
  } ?> type="text" value="<?php if ( $course_permalink ) {
96
  echo esc_attr( trailingslashit( $course_permalink ) );
97
  } ?>" class="regular-text code"/>
98
+ </label>
99
 
100
+ <p class="description"><?php _e( 'Enter a custom base to use. A base <strong>must</strong> be set or WordPress will use default values instead.', 'learnpress' ); ?></p>
101
+ </li>
102
+ </ul>
103
  <?php
104
  return ob_get_clean();
105
  }
inc/admin/meta-box/fields/email-content.php CHANGED
@@ -60,12 +60,14 @@ if ( ! class_exists( 'RWMB_Email_Content_Field' ) ) {
60
  ob_start();
61
  learn_press_email_formats_dropdown(
62
  array(
63
- 'name' => $field['field_name'] . '[format]',
64
- 'class' => 'lp-email-format',
65
- 'selected' => $email_format
 
66
  )
67
  );
68
  ?>
 
69
  <div class="lp-email-templates">
70
  <?php
71
  $templates = learn_press_email_formats();
@@ -78,7 +80,7 @@ if ( ! class_exists( 'RWMB_Email_Content_Field' ) ) {
78
  }
79
 
80
  $local_file = ! empty( $field["template_{$template_type}_local"] ) ? $field["template_{$template_type}_local"] : null;//$this->get_theme_template_file( $template, $this->template_path );
81
- $template_file = $field['template_base'] . $template;//$this->template_base . $template;
82
  $template_dir = $field['template_path'];//$this->template_path;//learn_press_template_path();
83
  $classes = array( 'learn-press-email-template' );
84
  //extract( $field['extra'] );
@@ -149,9 +151,6 @@ if ( ! class_exists( 'RWMB_Email_Content_Field' ) ) {
149
  <?php esc_html_e( 'Click on variables to add it into email content.', 'learnpress' ); ?>
150
  </p>
151
  <?php endif; ?>
152
- <!-- <p class="description">-->
153
- <!-- --><?php //printf( __( 'To override and edit this email template copy <code>%s</code> to your theme folder: <code>%s</code>.', 'learnpress' ), plugin_basename( $template_file ), $theme_folder . '/' . $template_dir . '/' . $template ); ?>
154
- <!-- </p>-->
155
  <?php endif; ?>
156
  </div>
157
  <?php
60
  ob_start();
61
  learn_press_email_formats_dropdown(
62
  array(
63
+ 'name' => $field['field_name'] . '[format]',
64
+ 'class' => 'lp-email-format',
65
+ 'selected' => $email_format,
66
+ 'option_none' => array( '' => __( 'General setting', 'learnpress' ) )
67
  )
68
  );
69
  ?>
70
+ <p class="description"><?php printf( __( 'Choose <strong>General setting</strong> to apply the setting from Email <a href="%s">General Options</a> ', 'learnpress' ), admin_url( 'admin.php?page=learn-press-settings&tab=emails&section=general' ) ); ?></p>
71
  <div class="lp-email-templates">
72
  <?php
73
  $templates = learn_press_email_formats();
80
  }
81
 
82
  $local_file = ! empty( $field["template_{$template_type}_local"] ) ? $field["template_{$template_type}_local"] : null;//$this->get_theme_template_file( $template, $this->template_path );
83
+ $template_file = $field['template_base'] . $template;//$this->template_base . $template;
84
  $template_dir = $field['template_path'];//$this->template_path;//learn_press_template_path();
85
  $classes = array( 'learn-press-email-template' );
86
  //extract( $field['extra'] );
151
  <?php esc_html_e( 'Click on variables to add it into email content.', 'learnpress' ); ?>
152
  </p>
153
  <?php endif; ?>
 
 
 
154
  <?php endif; ?>
155
  </div>
156
  <?php
inc/admin/meta-box/fields/list-emails.php CHANGED
@@ -61,7 +61,6 @@ if ( ! class_exists( 'RWMB_List_Emails_Field' ) ) {
61
  <span class="change-email-status dashicons dashicons-yes"
62
  data-status="<?php echo $email->enable ? 'on' : 'off'; ?>"
63
  data-id="<?php echo $email->id; ?>"></span>
64
- <a href="<?php echo $url; ?>"><?php _e( 'Settings', 'learnpress' ); ?></a>
65
  </td>
66
  </tr>
67
  <?php } ?>
61
  <span class="change-email-status dashicons dashicons-yes"
62
  data-status="<?php echo $email->enable ? 'on' : 'off'; ?>"
63
  data-id="<?php echo $email->id; ?>"></span>
 
64
  </td>
65
  </tr>
66
  <?php } ?>
inc/admin/settings/abstract-settings-page.php CHANGED
@@ -30,6 +30,7 @@ class LP_Abstract_Settings_Page extends LP_Abstract_Settings {
30
  * Constructor
31
  */
32
  public function __construct() {
 
33
  }
34
 
35
  /**
30
  * Constructor
31
  */
32
  public function __construct() {
33
+ parent::__construct();
34
  }
35
 
36
  /**
inc/admin/settings/class-lp-settings-courses.php CHANGED
@@ -15,33 +15,33 @@ class LP_Settings_Courses extends LP_Abstract_Settings_Page {
15
  }
16
 
17
  public function save() {
18
- parent::save();
19
- $course_permalink = $_POST['learn_press_course_base'];
20
- if ( $course_permalink == 'custom' ) {
21
- $course_permalink = trim( $_POST['course_permalink_structure'], '/' );
22
 
23
- if ( '%course_category%' == $course_permalink ) {
24
- $course_permalink = _x( 'courses', 'slug', 'learnpress' ) . '/' . $course_permalink;
25
- }
26
-
27
- $course_permalink = '/' . $course_permalink;
28
- update_option( 'learn_press_course_base_type', 'custom' );
29
 
30
- } else {
31
- delete_option( 'learn_press_course_base_type' );
32
- }
33
 
34
- $course_base = untrailingslashit( $course_permalink );
 
 
35
 
36
- update_option( 'learn_press_course_base', $course_base );
37
 
38
- $courses_page_id = learn_press_get_page_id( 'courses' );
39
- $courses_permalink = ( $courses_page_id > 0 && get_post( $courses_page_id ) ) ? get_page_uri( $courses_page_id ) : _x( 'courses', 'default-slug', 'learnpress' );
 
40
 
41
- if ( $courses_page_id && trim( $course_base, '/' ) === $courses_permalink ) {
42
- update_option( 'learn_press_use_verbose_page_rules', 'yes' );
43
- } else {
44
- delete_option( 'learn_press_use_verbose_page_rules' );
 
45
  }
46
  }
47
 
@@ -144,7 +144,7 @@ class LP_Settings_Courses extends LP_Abstract_Settings_Page {
144
  'title' => __( 'Single course permalink', 'learnpress' ),
145
  'type' => 'course-permalink',
146
  'default' => '',
147
- 'id' => 'course_base'
148
  ),
149
  array(
150
  'title' => __( 'Lesson', 'learnpress' ),
@@ -157,7 +157,7 @@ class LP_Settings_Courses extends LP_Abstract_Settings_Page {
157
  'title' => __( 'Quiz', 'learnpress' ),
158
  'type' => 'text',
159
  'id' => 'quiz_slug',
160
- 'desc' => __( sprintf( '%s/course/sample-course/<code>quizzes</code>/sample-lesson/', home_url() ), 'learnpress' ),
161
  'default' => 'quizzes'
162
  ),
163
  array(
15
  }
16
 
17
  public function save() {
18
+ if ( ! empty( $_POST['learn_press_course_base'] ) ) {
19
+ $course_permalink = $_POST['learn_press_course_base'];
20
+ if ( $course_permalink == 'custom' ) {
21
+ $course_permalink = trim( $_POST['course_permalink_structure'], '/' );
22
 
23
+ if ( '%course_category%' == $course_permalink ) {
24
+ $course_permalink = _x( 'courses', 'slug', 'learnpress' ) . '/' . $course_permalink;
25
+ }
 
 
 
26
 
27
+ $course_permalink = '/' . $course_permalink;
28
+ update_option( 'learn_press_course_base_type', 'custom' );
 
29
 
30
+ } else {
31
+ delete_option( 'learn_press_course_base_type' );
32
+ }
33
 
34
+ $course_base = untrailingslashit( $course_permalink );
35
 
36
+ update_option( 'learn_press_course_base', $course_base );
37
+ $courses_page_id = learn_press_get_page_id( 'courses' );
38
+ $courses_permalink = ( $courses_page_id > 0 && get_post( $courses_page_id ) ) ? get_page_uri( $courses_page_id ) : _x( 'courses', 'default-slug', 'learnpress' );
39
 
40
+ if ( $courses_page_id && trim( $course_base, '/' ) === $courses_permalink ) {
41
+ update_option( 'learn_press_use_verbose_page_rules', 'yes' );
42
+ } else {
43
+ delete_option( 'learn_press_use_verbose_page_rules' );
44
+ }
45
  }
46
  }
47
 
144
  'title' => __( 'Single course permalink', 'learnpress' ),
145
  'type' => 'course-permalink',
146
  'default' => '',
147
+ 'id' => 'course_base'
148
  ),
149
  array(
150
  'title' => __( 'Lesson', 'learnpress' ),
157
  'title' => __( 'Quiz', 'learnpress' ),
158
  'type' => 'text',
159
  'id' => 'quiz_slug',
160
+ 'desc' => __( sprintf( '%s/course/sample-course/<code>quizzes</code>/sample-quiz/', home_url() ), 'learnpress' ),
161
  'default' => 'quizzes'
162
  ),
163
  array(
inc/admin/settings/class-lp-settings-emails.php CHANGED
@@ -136,6 +136,17 @@ class LP_Settings_Emails extends LP_Abstract_Settings_Page {
136
  'title' => __( 'Email template', 'learnpress' ),
137
  'type' => 'heading'
138
  ),
 
 
 
 
 
 
 
 
 
 
 
139
  array(
140
  'title' => __( 'Header image', 'learnpress' ),
141
  'id' => 'emails_general[header_image]',
136
  'title' => __( 'Email template', 'learnpress' ),
137
  'type' => 'heading'
138
  ),
139
+ array(
140
+ 'title' => __( 'Default Email Content', 'learnpress' ),
141
+ 'id' => 'emails_general[default_email_content]',
142
+ 'default' => 'plain',
143
+ 'type' => 'select',
144
+ 'desc' => __( 'Default email content type for all emails that set content type is <strong>General Settings</strong>.', 'learnpress' ),
145
+ 'options' => array(
146
+ 'plain' => __( 'Plain Text', 'learnpress' ),
147
+ 'html' => __( 'HTML', 'learnpress' )
148
+ )
149
+ ),
150
  array(
151
  'title' => __( 'Header image', 'learnpress' ),
152
  'id' => 'emails_general[header_image]',
inc/admin/views/course/curriculum.php CHANGED
@@ -23,7 +23,7 @@ learn_press_admin_view( 'course/sections' );
23
  </script>
24
 
25
  <script type="text/javascript">
26
- jQuery(function () {
27
 
28
  (function (Vue, $store) {
29
 
23
  </script>
24
 
25
  <script type="text/javascript">
26
+ jQuery(function ($) {
27
 
28
  (function (Vue, $store) {
29
 
inc/admin/views/course/editor.php CHANGED
@@ -10,7 +10,7 @@ learn_press_admin_view( 'course/modal-choose-items' );
10
 
11
  ?>
12
  <script type="text/x-template" id="tmpl-lp-course-editor">
13
- <div id="admin-editor-lp_course" class='lp-admin-editor'>
14
 
15
  <div v-if="heartbeat">
16
  <form @submit.prevent="">
@@ -29,7 +29,7 @@ learn_press_admin_view( 'course/modal-choose-items' );
29
  </script>
30
 
31
  <script type="text/javascript">
32
- jQuery(function () {
33
  (function (Vue, $store) {
34
 
35
  Vue.component('lp-course-editor', {
10
 
11
  ?>
12
  <script type="text/x-template" id="tmpl-lp-course-editor">
13
+ <div id="admin-editor-lp_course" class='lp-admin-editor' xxxx>
14
 
15
  <div v-if="heartbeat">
16
  <form @submit.prevent="">
29
  </script>
30
 
31
  <script type="text/javascript">
32
+ jQuery(function ($) {
33
  (function (Vue, $store) {
34
 
35
  Vue.component('lp-course-editor', {
inc/admin/views/course/modal-choose-items.php CHANGED
@@ -19,7 +19,7 @@ learn_press_admin_view( 'course/pagination' );
19
 
20
  <script type="text/javascript">
21
 
22
- jQuery(function () {
23
  (function (Vue, $store) {
24
  Vue.component('lp-course-choose-item', {
25
  template: '#tmpl-lp-course-choose-item',
19
 
20
  <script type="text/javascript">
21
 
22
+ jQuery(function ($) {
23
  (function (Vue, $store) {
24
  Vue.component('lp-course-choose-item', {
25
  template: '#tmpl-lp-course-choose-item',
inc/admin/views/course/new-section-item.php CHANGED
@@ -10,7 +10,7 @@
10
 
11
  <script type="text/x-template" id="tmpl-lp-new-section-item">
12
  <div class="new-section-item section-item" @keyup.up="up" @keyup.down="down" :class="{choosing: choosingType}">
13
- <div class="drag"></div>
14
  <div class="types" @mouseleave="mouseLeave" @mouseover="mouseOver">
15
  <template v-for="(_type, key) in types">
16
  <label class="type" :title="_type" :class="[key, {current: (type==key)}]">
@@ -26,7 +26,7 @@
26
  </script>
27
 
28
  <script type="text/javascript">
29
- jQuery(function () {
30
 
31
  (function (Vue, $store) {
32
 
10
 
11
  <script type="text/x-template" id="tmpl-lp-new-section-item">
12
  <div class="new-section-item section-item" @keyup.up="up" @keyup.down="down" :class="{choosing: choosingType}">
13
+ <div class="drag lp-sortable-handle"></div>
14
  <div class="types" @mouseleave="mouseLeave" @mouseover="mouseOver">
15
  <template v-for="(_type, key) in types">
16
  <label class="type" :title="_type" :class="[key, {current: (type==key)}]">
26
  </script>
27
 
28
  <script type="text/javascript">
29
+ jQuery(function ($) {
30
 
31
  (function (Vue, $store) {
32
 
inc/admin/views/course/section-item.php CHANGED
@@ -7,9 +7,10 @@
7
  ?>
8
 
9
  <script type="text/x-template" id="tmpl-lp-section-item">
10
- <li :class="['section-item',item.type, isEmptyItem() ? 'empty-item' : '', {updating: updating, removing: removing}]" :data-item-id="item.id"
 
11
  :data-item-order="order">
12
- <div class="drag">
13
  <?php learn_press_admin_view('svg-icon');?>
14
  </div>
15
  <div class="icon"></div>
@@ -20,15 +21,16 @@
20
 
21
  <div class="item-actions">
22
  <div class="actions">
23
- <div class="action preview-item"
24
  data-content-tip="<?php echo esc_attr( 'Turn on/off this item is preview', 'learnpress' ); ?>">
25
  <a class="lp-btn-icon dashicons" :class="previewClass" @click="togglePreview"></a>
26
  </div>
27
- <div class="action edit-item">
28
- <a :href="url" target="_blank"
29
- class="lp-btn-icon dashicons dashicons-edit"></a>
30
  </div>
31
- <div class="action delete-item" v-if="!disableCurriculum">
 
32
  <a class="lp-btn-icon dashicons dashicons-trash" @click.prevent="remove"></a>
33
  <ul>
34
  <li>
@@ -67,16 +69,11 @@
67
  mounted: function () {
68
  this.$nextTick(function () {
69
  var $ = jQuery;
70
- $(this.$el).find('.preview-item').QuickTip({
71
  closeInterval: 0,
72
  arrowOffset: 'el',
73
  tipClass: 'preview-item-tip'
74
  });
75
- $(document).on('mousedown', '.section-item .drag', function (e) {
76
- $('html, body').addClass('moving');
77
- }).on('mouseup', function (e) {
78
- $('html, body').removeClass('moving');
79
- })
80
  })
81
  },
82
  computed: {
7
  ?>
8
 
9
  <script type="text/x-template" id="tmpl-lp-section-item">
10
+ <li :class="['section-item',item.type, isEmptyItem() ? 'empty-item' : '', {updating: updating, removing: removing}]"
11
+ :data-item-id="item.id"
12
  :data-item-order="order">
13
+ <div class="drag lp-sortable-handle">
14
  <?php learn_press_admin_view('svg-icon');?>
15
  </div>
16
  <div class="icon"></div>
21
 
22
  <div class="item-actions">
23
  <div class="actions">
24
+ <div class="action preview-item lp-title-attr-tip"
25
  data-content-tip="<?php echo esc_attr( 'Turn on/off this item is preview', 'learnpress' ); ?>">
26
  <a class="lp-btn-icon dashicons" :class="previewClass" @click="togglePreview"></a>
27
  </div>
28
+ <div class="action edit-item lp-title-attr-tip"
29
+ data-content-tip="<?php echo esc_attr( 'Edit item', 'learnpress' ); ?>">
30
+ <a :href="url" target="_blank" class="lp-btn-icon dashicons dashicons-edit"></a>
31
  </div>
32
+ <div class="action delete-item lp-title-attr-tip" v-if="!disableCurriculum"
33
+ data-content-tip="<?php echo esc_attr( 'Delete', 'learnpress' ); ?>">
34
  <a class="lp-btn-icon dashicons dashicons-trash" @click.prevent="remove"></a>
35
  <ul>
36
  <li>
69
  mounted: function () {
70
  this.$nextTick(function () {
71
  var $ = jQuery;
72
+ $(this.$el).find('.lp-title-attr-tip').QuickTip({
73
  closeInterval: 0,
74
  arrowOffset: 'el',
75
  tipClass: 'preview-item-tip'
76
  });
 
 
 
 
 
77
  })
78
  },
79
  computed: {
inc/admin/views/course/section.php CHANGED
@@ -14,7 +14,7 @@ learn_press_admin_view( 'course/new-section-item' );
14
  :data-section-order="index"
15
  :data-section-id="section.id">
16
  <div class="section-head" @dblclick="toggle">
17
- <span class="movable"></span>
18
  <!--Section title-->
19
  <input v-model="section.title" type="text" title="title" class="title-input"
20
  @change="updating" @blur="completed" @keyup.enter="completed"
@@ -55,8 +55,9 @@ learn_press_admin_view( 'course/new-section-item' );
55
  <button type="button" class="button button-secondary"
56
  @click="openModal"><?php esc_html_e( 'Select items', 'learnpress' ); ?></button>
57
 
58
- <div class="remove" :class="{confirm: confirm}">
59
- <span class="icon" @click="removing"><span class="dashicons dashicons-trash"></span></span>
 
60
  <div class="confirm" @click="remove"><?php esc_html_e( 'Are you sure?', 'learnpress' ); ?></div>
61
  </div>
62
  </div>
@@ -106,6 +107,20 @@ learn_press_admin_view( 'course/new-section-item' );
106
  }
107
  });
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  },
110
  computed: {
111
 
14
  :data-section-order="index"
15
  :data-section-id="section.id">
16
  <div class="section-head" @dblclick="toggle">
17
+ <span class="movable lp-sortable-handle"></span>
18
  <!--Section title-->
19
  <input v-model="section.title" type="text" title="title" class="title-input"
20
  @change="updating" @blur="completed" @keyup.enter="completed"
55
  <button type="button" class="button button-secondary"
56
  @click="openModal"><?php esc_html_e( 'Select items', 'learnpress' ); ?></button>
57
 
58
+ <div class="remove lp-title-attr-tip" :class="{confirm: confirm}" data-content-tip="<?php echo esc_attr( 'Delete section', 'learnpress' ); ?>">
59
+ <span class="icon" @click="removing"><span
60
+ class="dashicons dashicons-trash"></span></span>
61
  <div class="confirm" @click="remove"><?php esc_html_e( 'Are you sure?', 'learnpress' ); ?></div>
62
  </div>
63
  </div>
107
  }
108
  });
109
 
110
+ this.$nextTick(function () {
111
+ var $ = jQuery;
112
+ $(this.$el).find('.lp-title-attr-tip').QuickTip({
113
+ closeInterval: 0,
114
+ arrowOffset: 'el',
115
+ tipClass: 'preview-item-tip'
116
+ });
117
+ $(document).on('mousedown', '.section-item .drag', function (e) {
118
+ $('html, body').addClass('moving');
119
+ }).on('mouseup', function (e) {
120
+ $('html, body').removeClass('moving');
121
+ })
122
+ })
123
+
124
  },
125
  computed: {
126
 
inc/admin/views/dashboard/plugin-status/html-results.php CHANGED
@@ -3,7 +3,7 @@
3
  * Template for displaying LP information.
4
  */
5
  defined( 'ABSPATH' ) || exit();
6
- if ( ! isset( $plugin_data ) ) {
7
  return;
8
  }
9
  ?>
3
  * Template for displaying LP information.
4
  */
5
  defined( 'ABSPATH' ) || exit();
6
+ if ( ! isset( $plugin_data ) || is_wp_error($plugin_data) ) {
7
  return;
8
  }
9
  ?>
inc/admin/views/meta-boxes/order/child-order.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ */
5
+
6
+ if ( ! isset( $order ) ) {
7
+ $order = learn_press_get_order();
8
+ }
9
+
10
+ if ( ! $order->is_multi_users() ) {
11
+ return;
12
+ }
13
+ ?>
14
+
15
+ <h4><?php echo esc_html( 'Child orders', 'learnpress' ); ?></h4>
16
+
17
+ <table class="wp-list-table widefat fixed striped posts">
18
+ <thead>
19
+ <tr>
20
+ <th>#</th>
21
+ <th><?php _e( 'Customer', 'learnpress' ); ?></th>
22
+ <th><?php _e( 'Order key', 'learnpress' ); ?></th>
23
+ </tr>
24
+ </thead>
25
+ <tbody>
26
+ <?php foreach ( $child_orders = $order->get_child_orders() as $child_order_id ) { ?>
27
+ <?php
28
+ if ( ! $child_order = learn_press_get_order( $child_order_id ) ) {
29
+ continue;
30
+ }
31
+ ?>
32
+ <tr>
33
+ <td>
34
+ <strong><?php echo sprintf( '<a href="%s">%s</a>', admin_url( 'post.php?post=' . $child_order->get_id() . '&action=edit' ), $child_order->get_order_number() ); ?></strong>
35
+ </td>
36
+ <td><?php echo $child_order->get_customer_name(); ?></td>
37
+ <td><?php echo $child_order->get_order_key(); ?></td>
38
+ </tr>
39
+ <?php } ?>
40
+ </tbody>
41
+ </table>
inc/admin/views/meta-boxes/order/details.php CHANGED
@@ -11,12 +11,11 @@ if ( isset( $order_items ) ) {
11
  } else {
12
  $currency_symbol = learn_press_get_currency_symbol();
13
  }
14
- global $post;
15
 
16
  if ( ! isset( $order ) || ! ( $order instanceof LP_Order ) ) {
17
  return;
18
  }
19
-
20
  $method_title = $order->get_payment_method_title();
21
  $user_ip = $order->get_user_ip_address();
22
 
@@ -71,7 +70,8 @@ $user_ip = $order->get_user_ip_address();
71
 
72
  <?php if ( $order->is_multi_users() ) { ?>
73
  <label><?php _e( 'Customers', 'learnpress' ); ?></label>
74
- <ul id="list-users" class="advanced-list <?php echo $order->get_status()==='completed' ? 'locked' : '';?>">
 
75
  </ul>
76
 
77
  <?php if ( 'pending' === $order->get_status() ) { ?>
@@ -104,6 +104,8 @@ $user_ip = $order->get_user_ip_address();
104
  echo '<p class="description">';
105
  _e( 'In order to change the order user, please change the order status to \'Pending\'.', 'learnpress' );
106
  echo '</p>';
 
 
107
  } ?>
108
 
109
  </div>
@@ -181,7 +183,7 @@ $user_ip = $order->get_user_ip_address();
181
  </tfoot>
182
  </table>
183
  </div>
184
- <?php if ( $note = get_the_excerpt() ) { ?>
185
  <br/>
186
  <h3><?php _e( 'Customer Note', 'learnpress' ); ?></h3>
187
  <p class="order-note description"><?php echo $note; ?></p>
@@ -201,7 +203,8 @@ $user_ip = $order->get_user_ip_address();
201
  <div class="order-data-field order-data-user">
202
  <label><?php _e( 'Customer', 'learnpress' ); ?></label>
203
  <div class="order-users">
204
- <ul id="list-users" class="advanced-list <?php echo $order->get_status()==='completed' ? 'locked' : '';?>">
 
205
  </ul>
206
  </div>
207
  <a href="" class="change-user" data-multiple="yes"><?php _e( 'Add multi users', 'learnpress' ); ?></a>
11
  } else {
12
  $currency_symbol = learn_press_get_currency_symbol();
13
  }
 
14
 
15
  if ( ! isset( $order ) || ! ( $order instanceof LP_Order ) ) {
16
  return;
17
  }
18
+ $post = $order->get_post();
19
  $method_title = $order->get_payment_method_title();
20
  $user_ip = $order->get_user_ip_address();
21
 
70
 
71
  <?php if ( $order->is_multi_users() ) { ?>
72
  <label><?php _e( 'Customers', 'learnpress' ); ?></label>
73
+ <ul id="list-users"
74
+ class="advanced-list <?php echo $order->get_status() === 'completed' ? 'locked' : ''; ?>">
75
  </ul>
76
 
77
  <?php if ( 'pending' === $order->get_status() ) { ?>
104
  echo '<p class="description">';
105
  _e( 'In order to change the order user, please change the order status to \'Pending\'.', 'learnpress' );
106
  echo '</p>';
107
+
108
+ learn_press_admin_view( 'meta-boxes/order/child-order', array( 'order' => $order ) );
109
  } ?>
110
 
111
  </div>
183
  </tfoot>
184
  </table>
185
  </div>
186
+ <?php if ( $note = $post->post_excerpt ) { ?>
187
  <br/>
188
  <h3><?php _e( 'Customer Note', 'learnpress' ); ?></h3>
189
  <p class="order-note description"><?php echo $note; ?></p>
203
  <div class="order-data-field order-data-user">
204
  <label><?php _e( 'Customer', 'learnpress' ); ?></label>
205
  <div class="order-users">
206
+ <ul id="list-users"
207
+ class="advanced-list <?php echo $order->get_status() === 'completed' ? 'locked' : ''; ?>">
208
  </ul>
209
  </div>
210
  <a href="" class="change-user" data-multiple="yes"><?php _e( 'Add multi users', 'learnpress' ); ?></a>
inc/admin/views/question/option.php CHANGED
@@ -8,7 +8,7 @@
8
 
9
  <script type="text/x-template" id="tmpl-lp-question-answer-option">
10
  <tr class="answer-option" :class="[isNew() ? 'new-option' : '']" :data-answer-id="id">
11
- <td class="sort"><?php learn_press_admin_view( 'svg-icon' ); ?></td>
12
  <td class="order">{{index +1}}.</td>
13
  <td class="answer-text">
14
  <form @submit.prevent="">
@@ -58,6 +58,12 @@
58
  return !(this.number < 3 || (this.correct && $store.getters['numberCorrect'] === 1) || this.type === 'true_or_false');
59
  }
60
  },
 
 
 
 
 
 
61
  methods: {
62
  changeTitle: function () {
63
  this.changed = true;
8
 
9
  <script type="text/x-template" id="tmpl-lp-question-answer-option">
10
  <tr class="answer-option" :class="[isNew() ? 'new-option' : '']" :data-answer-id="id">
11
+ <td class="sort lp-sortable-handle"><?php learn_press_admin_view( 'svg-icon' ); ?></td>
12
  <td class="order">{{index +1}}.</td>
13
  <td class="answer-text">
14
  <form @submit.prevent="">
58
  return !(this.number < 3 || (this.correct && $store.getters['numberCorrect'] === 1) || this.type === 'true_or_false');
59
  }
60
  },
61
+ mounted: function () {
62
+ if (this.isNew()) {
63
+ this.changed = true;
64
+ this.updateTitle();
65
+ }
66
+ },
67
  methods: {
68
  changeTitle: function () {
69
  this.changed = true;
inc/admin/views/quiz/editor.php CHANGED
@@ -38,7 +38,7 @@ learn_press_admin_view( 'quiz/modal-choose-items' );
38
 
39
  <div class="footer" v-if="!disableUpdateList">
40
  <div class="table-row">
41
- <div class="sort"></div>
42
  <div class="order">{{countQuestions() + 1}}</div>
43
  <div class="name add-new-question">
44
  <div class="title">
38
 
39
  <div class="footer" v-if="!disableUpdateList">
40
  <div class="table-row">
41
+ <div class="sort lp-sortable-handle"></div>
42
  <div class="order">{{countQuestions() + 1}}</div>
43
  <div class="name add-new-question">
44
  <div class="title">
inc/admin/views/quiz/question-actions.php CHANGED
@@ -8,7 +8,7 @@
8
 
9
  <script type="text/x-template" id="tmpl-lp-quiz-question-actions">
10
  <div class="question-actions table-row" :class="status">
11
- <div class="sort">
12
  <i class="fa fa-bars"></i>
13
  </div>
14
  <div class="order">{{index +1}}</div>
@@ -19,23 +19,28 @@
19
  <div class="type">{{question.type.label}}</div>
20
  <div class="actions">
21
  <div class="lp-box-data-actions lp-toolbar-buttons">
22
- <div class="lp-toolbar-btn lp-toolbar-btn-dropdown lp-btn-change-type">
23
- <a class="lp-btn-icon dashicons dashicons-randomize" title="Change type"></a>
 
24
  <ul>
25
  <li v-for="(type, key) in questionTypes" :class="active(key)">
26
  <a href="" :data-type="key" @click.prevent="changeType(key)">{{type}}</a>
27
  </li>
28
  </ul>
29
  </div>
30
- <div class="lp-toolbar-btn">
31
- <a :href="url" target="_blank" class="lp-btn-icon dashicons dashicons-edit" title="Edit"></a>
 
 
32
  </div>
33
- <div class="lp-toolbar-btn" v-if="!disableUpdateList">
34
- <a href="" class="lp-btn-icon dashicons dashicons-admin-page" @click.prevent="clone"
35
- title="Duplicate"></a>
36
  </div>
37
- <div class="lp-toolbar-btn lp-btn-remove lp-toolbar-btn-dropdown" v-if="!disableUpdateList">
38
- <a class="lp-btn-icon dashicons dashicons-trash" @click.prevent="remove" title="Delete"></a>
 
 
39
  <ul>
40
  <li>
41
  <a @click.prevent="remove"
@@ -47,8 +52,7 @@
47
  </li>
48
  </ul>
49
  </div>
50
- <span :class="['lp-toolbar-btn lp-btn-toggle', question.open ?'open' : 'close']" @click="toggle"
51
- title="Toggle"></span>
52
  </div>
53
  </div>
54
  </div>
@@ -67,6 +71,21 @@
67
  changed: false
68
  };
69
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  computed: {
71
  // question status
72
  status: function () {
8
 
9
  <script type="text/x-template" id="tmpl-lp-quiz-question-actions">
10
  <div class="question-actions table-row" :class="status">
11
+ <div class="sort lp-sortable-handle">
12
  <i class="fa fa-bars"></i>
13
  </div>
14
  <div class="order">{{index +1}}</div>
19
  <div class="type">{{question.type.label}}</div>
20
  <div class="actions">
21
  <div class="lp-box-data-actions lp-toolbar-buttons">
22
+ <div class="lp-toolbar-btn lp-toolbar-btn-dropdown lp-btn-change-type lp-title-attr-tip"
23
+ data-content-tip="<?php echo esc_attr( 'Change type', 'learnpress' ); ?>">
24
+ <a class="lp-btn-icon dashicons dashicons-randomize"></a>
25
  <ul>
26
  <li v-for="(type, key) in questionTypes" :class="active(key)">
27
  <a href="" :data-type="key" @click.prevent="changeType(key)">{{type}}</a>
28
  </li>
29
  </ul>
30
  </div>
31
+ <div class="lp-toolbar-btn lp-title-attr-tip" v-if="!disableUpdateList"
32
+ data-content-tip="<?php echo esc_attr( 'Duplicate', 'learnpress' ); ?>">
33
+ <a href="" class="lp-btn-icon dashicons dashicons-admin-page"
34
+ @click.prevent="clone"></a>
35
  </div>
36
+ <div class="lp-toolbar-btn lp-title-attr-tip"
37
+ data-content-tip="<?php echo esc_attr( 'Edit item', 'learnpress' ); ?>">
38
+ <a :href="url" target="_blank" class="lp-btn-icon dashicons dashicons-edit"></a>
39
  </div>
40
+ <div class="lp-toolbar-btn lp-btn-remove lp-toolbar-btn-dropdown lp-title-attr-tip"
41
+ v-if="!disableUpdateList"
42
+ data-content-tip="<?php echo esc_attr( 'Delete', 'learnpress' ); ?>">
43
+ <a class="lp-btn-icon dashicons dashicons-trash" @click.prevent="remove"></a>
44
  <ul>
45
  <li>
46
  <a @click.prevent="remove"
52
  </li>
53
  </ul>
54
  </div>
55
+ <span :class="['lp-toolbar-btn lp-btn-toggle', question.open ?'open' : 'close']" @click="toggle"></span>
 
56
  </div>
57
  </div>
58
  </div>
71
  changed: false
72
  };
73
  },
74
+ mounted: function () {
75
+ this.$nextTick(function () {
76
+ var $ = jQuery;
77
+ $(this.$el).find('.lp-title-attr-tip').QuickTip({
78
+ closeInterval: 0,
79
+ arrowOffset: 'el',
80
+ tipClass: 'preview-item-tip'
81
+ });
82
+ $(document).on('mousedown', '.section-item .drag', function (e) {
83
+ $('html, body').addClass('moving');
84
+ }).on('mouseup', function (e) {
85
+ $('html, body').removeClass('moving');
86
+ })
87
+ })
88
+ },
89
  computed: {
90
  // question status
91
  status: function () {
inc/admin/views/quiz/question-answer-option.php CHANGED
@@ -9,7 +9,7 @@
9
  <script type="text/x-template" id="tmpl-lp-quiz-question-answer-option">
10
  <tr class="answer-option" :class="[isNew() ? 'empty-option' : '']" :data-answer-id="answer.question_answer_id"
11
  :data-order-answer="index">
12
- <td class="sort"><?php learn_press_admin_view( 'svg-icon' ); ?></td>
13
  <td class="order">{{index +1}}.</td>
14
  <td class="answer-text">
15
  <input type="text" v-model="answer.text"
9
  <script type="text/x-template" id="tmpl-lp-quiz-question-answer-option">
10
  <tr class="answer-option" :class="[isNew() ? 'empty-option' : '']" :data-answer-id="answer.question_answer_id"
11
  :data-order-answer="index">
12
+ <td class="sort lp-sortable-handle"><?php learn_press_admin_view( 'svg-icon' ); ?></td>
13
  <td class="order">{{index +1}}.</td>
14
  <td class="answer-text">
15
  <input type="text" v-model="answer.text"
inc/admin/views/quiz/question-answer.php CHANGED
@@ -49,7 +49,7 @@ learn_press_admin_view( 'quiz/question-answer-option' );
49
  },
50
  mounted: function () {
51
  var _self = this;
52
- setTimeout(function () {
53
  var $el = $(_self.$el).find('.lp-list-options tbody');
54
  $el.sortable({
55
  handle: '.sort',
@@ -68,7 +68,7 @@ learn_press_admin_view( 'quiz/question-answer-option' );
68
  _self.sort();
69
  }
70
  });
71
- }, 1000)
72
 
73
  },
74
  methods: {
49
  },
50
  mounted: function () {
51
  var _self = this;
52
+ //setTimeout(function () {
53
  var $el = $(_self.$el).find('.lp-list-options tbody');
54
  $el.sortable({
55
  handle: '.sort',
68
  _self.sort();
69
  }
70
  });
71
+ //}, 1000)
72
 
73
  },
74
  methods: {
inc/admin/views/quiz/question-settings.php CHANGED
@@ -25,7 +25,7 @@ learn_press_admin_view( 'quiz/question-meta' );
25
 
26
 
27
  <script type="text/javascript">
28
- (function (Vue, $store) {
29
  Vue.component('lp-quiz-question-settings', {
30
  template: '#tmpl-lp-quiz-question-settings',
31
  props: ['question', 'index'],
@@ -41,5 +41,5 @@ learn_press_admin_view( 'quiz/question-meta' );
41
  }
42
  }
43
  })
44
- })(Vue, LP_Quiz_Store)
45
  </script>
25
 
26
 
27
  <script type="text/javascript">
28
+ (function ($, Vue, $store) {
29
  Vue.component('lp-quiz-question-settings', {
30
  template: '#tmpl-lp-quiz-question-settings',
31
  props: ['question', 'index'],
41
  }
42
  }
43
  })
44
+ })(jQuery, Vue, LP_Quiz_Store)
45
  </script>
inc/admin/views/tools/course/html-course.php CHANGED
@@ -9,13 +9,16 @@ defined( 'ABSPATH' ) or die();
9
 
10
  ?>
11
  <div id="learn-press-reset-course-users" class="card">
12
- <h2><?php _e( 'Reset course user data', 'learnpress' ); ?></h2>
13
- <p class="description">
14
- <?php _e( 'Search results only show course have user data.', 'learnpress' ); ?>
15
- </p>
 
16
  <p>
17
- <input type="text" name="s" @keyup="updateSearch($event)" autocomplete="off">
18
- <button class="button" @click="search($event)" :disabled="s.length < 3"><?php _e( 'Search', 'learnpress' ); ?></button>
 
 
19
  </p>
20
 
21
  <template v-if="courses.length > 0">
@@ -34,10 +37,12 @@ defined( 'ABSPATH' ) or die();
34
  <td>{{course.title}}</td>
35
  <td>{{course.students}}</td>
36
  <td>
37
- <a v-if="!course.status" href=""
38
- @click="reset($event, course);"><?php _e( 'Reset', 'learnpress' ); ?></a>
39
- <span v-else-if="course.status=='done'"><?php _e( 'Done', 'learnpress' ); ?></span>
40
- <span v-else-if="course.status=='resetting'"><?php _e( 'Resetting...', 'learnpress' ); ?></span>
 
 
41
  </td>
42
  </tr>
43
  </tbody>
@@ -54,7 +59,7 @@ defined( 'ABSPATH' ) or die();
54
 
55
  // Translation
56
  $localize = array(
57
- 'reset_course_users' => __( 'Remove all users from this course?', 'learnpress' )
58
  );
59
  ?>
60
  <script>
@@ -69,6 +74,13 @@ $localize = array(
69
  courses: []
70
  },
71
  methods: {
 
 
 
 
 
 
 
72
  updateSearch: function (e) {
73
  this.s = e.target.value;
74
  this.status = false;
9
 
10
  ?>
11
  <div id="learn-press-reset-course-users" class="card">
12
+ <h2><?php _e( 'Reset course progress', 'learnpress' ); ?></h2>
13
+ <div class="description">
14
+ <p><?php _e( 'This action will reset progress of a course for all users have enrolled.', 'learnpress' ); ?></p>
15
+ <p><?php _e( 'Search results only show course have user data.', 'learnpress' ); ?></p>
16
+ </div>
17
  <p>
18
+ <input type="text" name="s" @keyup="updateSearch($event)" autocomplete="off"
19
+ placeholder="<?php esc_attr_e( 'Search course by name', 'learnpress' ); ?>">
20
+ <button class="button" @click="search($event)"
21
+ :disabled="s.length < 3"><?php _e( 'Search', 'learnpress' ); ?></button>
22
  </p>
23
 
24
  <template v-if="courses.length > 0">
37
  <td>{{course.title}}</td>
38
  <td>{{course.students}}</td>
39
  <td>
40
+ <a class="action-reset dashicons"
41
+ href=""
42
+ @click="reset($event, course);"
43
+ :class="resetActionClass(course)"></a>
44
+ <!-- <span v-else-if="course.status=='done'">--><?php //_e( 'Done', 'learnpress' ); ?><!--</span>-->
45
+ <!-- <span v-else-if="course.status=='resetting'">--><?php //_e( 'Resetting...', 'learnpress' ); ?><!--</span>-->
46
  </td>
47
  </tr>
48
  </tbody>
59
 
60
  // Translation
61
  $localize = array(
62
+ 'reset_course_users' => __( 'Are you sure to reset course progress of all users enrolled this course?', 'learnpress' )
63
  );
64
  ?>
65
  <script>
74
  courses: []
75
  },
76
  methods: {
77
+ resetActionClass: function (course) {
78
+ return {
79
+ 'dashicons-trash': !course.status,
80
+ 'dashicons-yes': course.status === 'done',
81
+ 'dashicons-update': course.status === 'resetting'
82
+ }
83
+ },
84
  updateSearch: function (e) {
85
  this.s = e.target.value;
86
  this.status = false;
inc/admin/views/tools/course/html-user-item.php CHANGED
@@ -9,10 +9,10 @@ defined( 'ABSPATH' ) or die();
9
 
10
  ?>
11
  <div id="learn-press-reset-user-item" class="card">
12
- <h2><?php _e( 'Reset item data for an user', 'learnpress' ); ?></h2>
13
- <p class="description">
14
- <?php _e( 'Search results only show users have course data.', 'learnpress' ); ?>
15
- </p>
16
  <table>
17
  <tr>
18
  <td><strong><?php _e( 'User ID or Email', 'learnpress' ); ?></strong></td>
@@ -32,7 +32,7 @@ defined( 'ABSPATH' ) or die();
32
 
33
  // Translation
34
  $localize = array(
35
- 'reset_course_users' => __( 'Remove all users from this course?', 'learnpress' )
36
  );
37
  ?>
38
  <script>
9
 
10
  ?>
11
  <div id="learn-press-reset-user-item" class="card">
12
+ <h2><?php _e( 'Reset item progress for an user', 'learnpress' ); ?></h2>
13
+ <div class="description">
14
+ <?php _e( 'This action will reset progress of specific lesson or quiz.', 'learnpress' ); ?>
15
+ </div>
16
  <table>
17
  <tr>
18
  <td><strong><?php _e( 'User ID or Email', 'learnpress' ); ?></strong></td>
32
 
33
  // Translation
34
  $localize = array(
35
+ 'reset_course_users' => __( 'Are you sure to reset progress of this item?', 'learnpress' )
36
  );
37
  ?>
38
  <script>
inc/admin/views/tools/course/html-user.php CHANGED
@@ -9,13 +9,16 @@ defined( 'ABSPATH' ) or die();
9
 
10
  ?>
11
  <div id="learn-press-reset-user-courses" class="card">
12
- <h2><?php _e( 'Reset course data by user', 'learnpress' ); ?></h2>
13
- <p class="description">
14
- <?php _e( 'Search results only show users have course data.', 'learnpress' ); ?>
15
- </p>
 
16
  <p>
17
- <input class="wide-fat" type="text" name="s" @keyup="updateSearch($event)">
18
- <button class="button" @click="search($event)" :disabled="s.length < 3"><?php _e( 'Search', 'learnpress' ); ?></button>
 
 
19
  </p>
20
 
21
  <template v-if="users.length > 0">
@@ -37,15 +40,17 @@ defined( 'ABSPATH' ) or die();
37
  <li v-for="course in user.courses">
38
  <a :href="course.url" target="_blank">{{course.title}} (#{{course.id}})</a>
39
  <a href=""
40
- @click="reset($event, user, course.id);"><?php _e( 'Reset', 'learnpress' ); ?></a>
 
 
41
  </li>
42
  </ul>
43
  </td>
44
  <td>
45
- <a v-if="!user.status" href=""
46
- @click="reset($event, user);"><?php _e( 'Reset all', 'learnpress' ); ?></a>
47
- <span v-else-if="user.status=='done'"><?php _e( 'Done', 'learnpress' ); ?></span>
48
- <span v-else-if="user.status=='resetting'"><?php _e( 'Resetting...', 'learnpress' ); ?></span>
49
  </td>
50
  </tr>
51
  </tbody>
@@ -62,7 +67,7 @@ defined( 'ABSPATH' ) or die();
62
 
63
  // Translation
64
  $localize = array(
65
- 'reset_course_users' => __( 'Remove all users from this course?', 'learnpress' )
66
  );
67
  ?>
68
  <script>
@@ -77,6 +82,14 @@ $localize = array(
77
  users: []
78
  },
79
  methods: {
 
 
 
 
 
 
 
 
80
  updateSearch: function (e) {
81
  this.s = e.target.value;
82
  this.status = false;
@@ -102,7 +115,13 @@ $localize = array(
102
  s: this.s
103
  },
104
  success: function (response) {
105
- that.users = LP.parseJSON(response);
 
 
 
 
 
 
106
  that.status = 'result';
107
  }
108
  })
@@ -115,7 +134,17 @@ $localize = array(
115
  return;
116
  }
117
  var that = this;
118
- user.status = 'resetting';
 
 
 
 
 
 
 
 
 
 
119
  $.ajax({
120
  url: '',
121
  data: {
@@ -128,7 +157,14 @@ $localize = array(
128
  //if (response.id == user.id) {
129
  for (var i = 0, n = that.users.length; i < n; i++) {
130
  if (that.users[i].id === user.id) {
131
- that.users[i].status = 'done';
 
 
 
 
 
 
 
132
  break;
133
  }
134
  }
9
 
10
  ?>
11
  <div id="learn-press-reset-user-courses" class="card">
12
+ <h2><?php _e( 'Reset user progress', 'learnpress' ); ?></h2>
13
+ <div class="description">
14
+ <p><?php _e( 'This action will reset progress of all courses that an user has enrolled.', 'learnpress' ); ?></p>
15
+ <p><?php _e( 'Search results only show users have course data.', 'learnpress' ); ?></p>
16
+ </div>
17
  <p>
18
+ <input class="wide-fat" type="text" name="s" @keyup="updateSearch($event)"
19
+ placeholder="<?php esc_attr_e( 'Search user by login name or email', 'learnpress' ); ?>">
20
+ <button class="button" @click="search($event)"
21
+ :disabled="s.length < 3"><?php _e( 'Search', 'learnpress' ); ?></button>
22
  </p>
23
 
24
  <template v-if="users.length > 0">
40
  <li v-for="course in user.courses">
41
  <a :href="course.url" target="_blank">{{course.title}} (#{{course.id}})</a>
42
  <a href=""
43
+ class="action-reset dashicons"
44
+ @click="reset($event, user, course.id);"
45
+ :class="resetActionClass(user, course)"></a>
46
  </li>
47
  </ul>
48
  </td>
49
  <td>
50
+ <a href=""
51
+ class="action-reset dashicons"
52
+ :class="resetActionClass(user)"
53
+ @click="reset($event, user);"></a>
54
  </td>
55
  </tr>
56
  </tbody>
67
 
68
  // Translation
69
  $localize = array(
70
+ 'reset_course_users' => __( 'Are you sure to reset course progress of all users enrolled this course?', 'learnpress' )
71
  );
72
  ?>
73
  <script>
82
  users: []
83
  },
84
  methods: {
85
+ resetActionClass: function (user, course) {
86
+ var status = course ? course.status : user.status;
87
+ return {
88
+ 'dashicons-trash': !status,
89
+ 'dashicons-yes': status === 'done',
90
+ 'dashicons-update': status === 'resetting'
91
+ }
92
+ },
93
  updateSearch: function (e) {
94
  this.s = e.target.value;
95
  this.status = false;
115
  s: this.s
116
  },
117
  success: function (response) {
118
+ var users = LP.parseJSON(response);
119
+ for(var i = 0; i < users.length; i++) {
120
+ for (var j in users[i].courses) {
121
+ users[i].courses[j].status = ''
122
+ }
123
+ }
124
+ that.users = users;
125
  that.status = 'result';
126
  }
127
  })
134
  return;
135
  }
136
  var that = this;
137
+ if(course_id){
138
+ user.courses[course_id].status = 'resetting'
139
+ }else{
140
+ for(var j in user.courses ){
141
+ user.courses[j].status = 'resetting'
142
+ }
143
+ user.status = 'resetting';
144
+ }
145
+
146
+ console.log(user.courses);
147
+
148
  $.ajax({
149
  url: '',
150
  data: {
157
  //if (response.id == user.id) {
158
  for (var i = 0, n = that.users.length; i < n; i++) {
159
  if (that.users[i].id === user.id) {
160
+ if(course_id){
161
+ that.users[i].courses[course_id].status = 'done'
162
+ }else{
163
+ for(var j in that.users[i].courses ){
164
+ that.users[i].courses[j].status = 'done'
165
+ }
166
+ user.status = 'done';
167
+ }
168
  break;
169
  }
170
  }
inc/admin/views/updates/html-updated-latest-message.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template for displaying message after LP updated to latest version
4
+ *
5
+ * @author ThimPress
6
+ * @package LearnPress/Admin/Views
7
+ * @version 3.0.8
8
+ */
9
+ defined( 'ABSPATH' ) or die();
10
+
11
+ //
12
+ LP()->session->remove( 'do-update-learnpress', true );
13
+
14
+ ?>
15
+ <div class="updated notice">
16
+ <p><?php esc_html_e( 'LearnPress has just updated to latest version.', 'learnpress' ); ?></p>
17
+ </div>
inc/admin/views/updates/html-updating-message.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template for displaying message when LP updating to latest version
4
+ *
5
+ * @author ThimPress
6
+ * @package LearnPress/Admin/Views
7
+ * @version 3.0.8
8
+ */
9
+ defined( 'ABSPATH' ) or die();
10
+
11
+ ?>
12
+ <div class="notice notice-warning lp-notice-update-database do-updating">
13
+ <p>
14
+ <?php _e( '<strong>LearnPress update</strong> – We are running updater to upgrade your database to the latest version.', 'learnpress' ); ?>
15
+ </p>
16
+ </div>
17
+
18
+ <script type="text/javascript">
19
+ (function (win, doc) {
20
+ var t = null;
21
+
22
+ function sendRequest() {
23
+ t = setTimeout(function () {
24
+ var $ = jQuery;
25
+ $.ajax({
26
+ url: '',
27
+ data: {
28
+ 'lp-ajax': 'check-updated'
29
+ },
30
+ success: function (response) {
31
+ response = LP.parseJSON(response);
32
+ if (response.result === 'success') {
33
+ clearInterval(t);
34
+ $('.lp-notice-update-database.do-updating').replaceWith($(response.message));
35
+ return;
36
+ }
37
+
38
+ sendRequest();
39
+ }
40
+ });
41
+ }, 3000);
42
+ }
43
+
44
+ if (document.readyState === "complete") {
45
+ sendRequest.apply(win);
46
+ } else {
47
+ window.addEventListener('load', sendRequest);
48
+ }
49
+ })(window, document)
50
+
51
+ </script>
inc/background-process/class-lp-background-clear-temp-users.php CHANGED
@@ -24,7 +24,7 @@ if ( ! class_exists( 'LP_Background_Clear_Temp_Users' ) ) {
24
  /**
25
  * @var string
26
  */
27
- protected $transient_key = 'lp_schedule_complete_items';
28
 
29
 
30
  /**
@@ -42,6 +42,8 @@ if ( ! class_exists( 'LP_Background_Clear_Temp_Users' ) ) {
42
  protected function task( $data ) {
43
  global $wpdb;
44
 
 
 
45
  if ( ! empty( $data['action'] ) && 'clear_temp_users' == $data['action'] ) {
46
  $query = $wpdb->prepare( "
47
  DELETE a.*, b.*
24
  /**
25
  * @var string
26
  */
27
+ protected $transient_key = 'lp_schedule_clear_temp_users';
28
 
29
 
30
  /**
42
  protected function task( $data ) {
43
  global $wpdb;
44
 
45
+ parent::task( $data );
46
+
47
  if ( ! empty( $data['action'] ) && 'clear_temp_users' == $data['action'] ) {
48
  $query = $wpdb->prepare( "
49
  DELETE a.*, b.*
inc/background-process/class-lp-background-emailer.php CHANGED
@@ -37,6 +37,7 @@ if ( ! class_exists( 'LP_Background_Emailer' ) ) {
37
  * @return bool
38
  */
39
  protected function task( $callback ) {
 
40
 
41
  if ( isset( $callback['filter'], $callback['args'] ) ) {
42
  try {
@@ -50,4 +51,6 @@ if ( ! class_exists( 'LP_Background_Emailer' ) ) {
50
  return false;
51
  }
52
  }
53
- }
 
 
37
  * @return bool
38
  */
39
  protected function task( $callback ) {
40
+ parent::task( $callback );
41
 
42
  if ( isset( $callback['filter'], $callback['args'] ) ) {
43
  try {
51
  return false;
52
  }
53
  }
54
+ }
55
+
56
+ return LP_Background_Emailer::instance();
inc/background-process/class-lp-background-global.php CHANGED
@@ -53,16 +53,19 @@ if ( ! class_exists( 'LP_Background_Global' ) ) {
53
  * @return bool
54
  */
55
  protected function task( $callback ) {
 
56
 
57
  if ( isset( $callback['action'] ) ) {
58
  $args = isset( $callback['args'] ) ? $callback['args'] : array();
59
  try {
60
 
61
  if ( is_callable( $callback['callback'] ) ) {
62
- call_user_func_array( $callback['callback'], $args );
 
63
  }
64
 
65
- do_action_ref_array( 'learn-press/background/' . $callback['action'], $args );
 
66
  }
67
  catch ( Exception $e ) {
68
 
@@ -72,4 +75,6 @@ if ( ! class_exists( 'LP_Background_Global' ) ) {
72
  return false;
73
  }
74
  }
75
- }
 
 
53
  * @return bool
54
  */
55
  protected function task( $callback ) {
56
+ parent::task( $callback );
57
 
58
  if ( isset( $callback['action'] ) ) {
59
  $args = isset( $callback['args'] ) ? $callback['args'] : array();
60
  try {
61
 
62
  if ( is_callable( $callback['callback'] ) ) {
63
+ //call_user_func_array( $callback['callback'], $args );
64
+ call_user_func( $callback['callback'], $callback );
65
  }
66
 
67
+ //do_action_ref_array( 'learn-press/background/' . $callback['action'], $args );
68
+ do_action( 'learn-press/background/' . $callback['action'], $callback );
69
  }
70
  catch ( Exception $e ) {
71
 
75
  return false;
76
  }
77
  }
78
+ }
79
+
80
+ return LP_Background_Global::instance();
inc/background-process/class-lp-background-installer.php CHANGED
@@ -26,7 +26,9 @@ if ( ! class_exists( 'LP_Background_Installer' ) ) {
26
  public function __construct() {
27
  parent::__construct();
28
 
29
- add_action( 'wp_loaded', array( $this, 'check' ), 100 );
 
 
30
  }
31
 
32
  public function check() {
@@ -35,7 +37,6 @@ if ( ! class_exists( 'LP_Background_Installer' ) ) {
35
  'check_tables' => 'yes'
36
  )
37
  );
38
- ///LP_Install::create_tables();
39
  }
40
 
41
  /**
@@ -44,6 +45,7 @@ if ( ! class_exists( 'LP_Background_Installer' ) ) {
44
  * @return bool
45
  */
46
  protected function task( $data ) {
 
47
 
48
  if ( ! isset( $data['check_tables'] ) ) {
49
  return false;
@@ -51,9 +53,45 @@ if ( ! class_exists( 'LP_Background_Installer' ) ) {
51
 
52
  LP_Install::create_tables();
53
 
 
 
 
 
54
  return false;
55
  }
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  /**
58
  * @return LP_Background_Installer
59
  */
@@ -63,4 +101,4 @@ if ( ! class_exists( 'LP_Background_Installer' ) ) {
63
  }
64
  }
65
 
66
- LP_Background_Installer::instance();
26
  public function __construct() {
27
  parent::__construct();
28
 
29
+ if ( 'yes' !== get_option( 'learn_press_check_tables' ) ) {
30
+ add_action( 'wp_loaded', array( $this, 'check' ), 100 );
31
+ }
32
  }
33
 
34
  public function check() {
37
  'check_tables' => 'yes'
38
  )
39
  );
 
40
  }
41
 
42
  /**
45
  * @return bool
46
  */
47
  protected function task( $data ) {
48
+ parent::task( $data );
49
 
50
  if ( ! isset( $data['check_tables'] ) ) {
51
  return false;
53
 
54
  LP_Install::create_tables();
55
 
56
+ if ( ! $this->get_missing_tables() ) {
57
+ update_option( 'learn_press_check_tables', 'yes', 'yes' );
58
+ }
59
+
60
  return false;
61
  }
62
 
63
+ /**
64
+ * Get all the tables are not created
65
+ *
66
+ * @return array
67
+ */
68
+ protected function get_missing_tables() {
69
+ global $wpdb;
70
+ $query = $wpdb->prepare( "
71
+ SHOW TABLES LIKE %s
72
+ ", '%' . $wpdb->esc_like( 'learnpress' ) . '%' );
73
+
74
+ $tables = $wpdb->get_col( $query );
75
+
76
+ $required_tables = get_object_vars( $wpdb );
77
+ $required_tables = array_filter( $required_tables, array( $this, '_filter_tables' ) );
78
+
79
+ return array_diff( $required_tables, $tables );
80
+ }
81
+
82
+ /**
83
+ * Filter callback
84
+ *
85
+ * @param $prop
86
+ *
87
+ * @return bool
88
+ */
89
+ protected function _filter_tables( $prop ) {
90
+ global $wpdb;
91
+
92
+ return is_string( $prop ) && strpos( $prop, $wpdb->prefix . 'learnpress' ) !== false;
93
+ }
94
+
95
  /**
96
  * @return LP_Background_Installer
97
  */
101
  }
102
  }
103
 
104
+ return LP_Background_Installer::instance();
inc/background-process/class-lp-background-query-items.php CHANGED
@@ -17,7 +17,7 @@ if ( ! class_exists( 'LP_Background_Query_Items' ) ) {
17
  /**
18
  * @var string
19
  */
20
- protected $action = 'lp_mailer';
21
 
22
  /**
23
  * @var int
@@ -37,6 +37,7 @@ if ( ! class_exists( 'LP_Background_Query_Items' ) ) {
37
  * @return bool
38
  */
39
  protected function task( $data ) {
 
40
 
41
  if ( ! isset( $data['callback'] ) ) {
42
  return false;
@@ -204,4 +205,6 @@ if ( ! class_exists( 'LP_Background_Query_Items' ) ) {
204
  return $themes;
205
  }
206
  }
207
- }
 
 
17
  /**
18
  * @var string
19
  */
20
+ protected $action = 'lp_query_items';
21
 
22
  /**
23
  * @var int
37
  * @return bool
38
  */
39
  protected function task( $data ) {
40
+ parent::task( $data );
41
 
42
  if ( ! isset( $data['callback'] ) ) {
43
  return false;
205
  return $themes;
206
  }
207
  }
208
+ }
209
+
210
+ return LP_Background_Query_Items::instance();
inc/background-process/class-lp-background-schedule-items.php CHANGED
@@ -34,67 +34,76 @@ if ( ! class_exists( 'LP_Background_Schedule_Items' ) ) {
34
  parent::__construct();
35
  }
36
 
 
 
 
 
37
  /**
38
  * @param mixed $data
39
  *
40
  * @return bool
41
  */
42
  protected function task( $data ) {
43
- $this->_get_items();
44
- if ( ! $items = get_transient( $this->transient_key ) ) {
45
- return false;
46
- }
47
 
48
- $curd = new LP_User_CURD();
 
 
 
 
 
49
 
50
- foreach ( $items as $course_item_id => $item_data ) {
51
 
52
- if ( ! $item_course = $curd->get_user_item_course( $course_item_id ) ) {
53
- continue;
54
- }
55
 
56
- $course_exceeded = $item_course->is_exceeded() <= 0;
 
 
57
 
58
- if ( ! empty( $item_data ) ) {
59
- foreach ( $item_data as $user_item_id ) {
60
 
61
- if ( ! $user_item = $item_course->get_item_by_user_item_id( $user_item_id ) ) {
62
- continue;
63
- }
64
- switch ( $user_item->get_post_type() ) {
65
- case LP_QUIZ_CPT:
66
- if ( $user_item->get_status() == 'started' ) {
67
- if ( ( $item_course->is_finished() || $course_exceeded ) || $user_item->is_exceeded() <= 0 ) {
 
 
 
 
 
 
 
 
 
68
  $user_item->complete();
69
  }
70
- }
71
- break;
72
- case LP_LESSON_CPT:
73
- if ( $user_item->is_exceeded() <= 0 ) {
74
- $user_item->complete();
75
- }
76
- break;
77
- default:
78
- do_action( 'learn-press/schedule/auto-complete-item', $user_item_id );
79
  }
80
  }
81
- }
82
 
83
- if ( ( ( $exceeded = $item_course->is_exceeded() ) <= 0 ) && ( $item_course->get_status() === 'enrolled' ) ) {
84
- $item_course->finish();
85
 
86
- $start_time = $item_course->get_start_time()->getTimestamp();
87
- $duration = $item_course->get_course()->get_duration();
88
 
89
- learn_press_update_user_item_meta( $item_course->get_user_item_id(), 'via', 'schedule' );
90
- learn_press_update_user_item_meta( $item_course->get_user_item_id(), 'exceeded', $exceeded );
 
91
  }
92
- }
93
 
94
- remove_action( 'shutdown', array( $this, 'dispatch_queue' ) );
 
 
95
 
96
  return false;
97
-
98
  }
99
 
100
  /**
@@ -106,6 +115,7 @@ if ( ! class_exists( 'LP_Background_Schedule_Items' ) ) {
106
  global $wpdb;
107
  $queued_items = get_transient( $this->transient_key );
108
  $queued_course_ids = $queued_items ? array_keys( $queued_items ) : false;
 
109
  $exclude_items = $queued_course_ids ? "AND user_item_id NOT IN(" . join( ',', $queued_course_ids ) . ")" : '';
110
 
111
  $null_time = '0000-00-00 00:00:00';
@@ -130,7 +140,7 @@ if ( ! class_exists( 'LP_Background_Schedule_Items' ) ) {
130
  $format = array_fill( 0, sizeof( $course_item_types ), '%s' );
131
  $args = $course_item_types;
132
  $new_items = array();
133
-
134
  foreach ( $item_courses as $item_course ) {
135
  $new_items[ $item_course->user_item_id ] = array();
136
 
@@ -202,5 +212,13 @@ if ( ! class_exists( 'LP_Background_Schedule_Items' ) ) {
202
  wp_schedule_event( time() + 10, $this->cron_interval_identifier, $this->cron_hook_identifier );
203
  }
204
  }
 
 
 
 
 
 
 
205
  }
206
- }
 
34
  parent::__construct();
35
  }
36
 
37
+ public function test() {
38
+ $this->task( 0 );
39
+ }
40
+
41
  /**
42
  * @param mixed $data
43
  *
44
  * @return bool
45
  */
46
  protected function task( $data ) {
47
+ parent::task( $data );
 
 
 
48
 
49
+ $x = ! empty( $_REQUEST['xxx'] );
50
+ if ( $x ) {
51
+ $this->_get_items();
52
+ if ( ! $items = get_transient( $this->transient_key ) ) {
53
+ return false;
54
+ }
55
 
56
+ $curd = new LP_User_CURD();
57
 
58
+ foreach ( $items as $course_item_id => $item_data ) {
 
 
59
 
60
+ if ( ! $item_course = $curd->get_user_item_course( $course_item_id ) ) {
61
+ continue;
62
+ }
63
 
64
+ $course_exceeded = $item_course->is_exceeded() <= 0;
 
65
 
66
+ if ( ! empty( $item_data ) ) {
67
+ foreach ( $item_data as $user_item_id ) {
68
+
69
+ if ( ! $user_item = $item_course->get_item_by_user_item_id( $user_item_id ) ) {
70
+ continue;
71
+ }
72
+ switch ( $user_item->get_post_type() ) {
73
+ case LP_QUIZ_CPT:
74
+ if ( $user_item->get_status() == 'started' ) {
75
+ if ( ( $item_course->is_finished() || $course_exceeded ) || $user_item->is_exceeded() <= 0 ) {
76
+ $user_item->complete();
77
+ }
78
+ }
79
+ break;
80
+ case LP_LESSON_CPT:
81
+ if ( $user_item->is_exceeded() <= 0 ) {
82
  $user_item->complete();
83
  }
84
+ break;
85
+ default:
86
+ do_action( 'learn-press/schedule/auto-complete-item', $user_item_id );
87
+ }
 
 
 
 
 
88
  }
89
  }
 
90
 
91
+ if ( ( ( $exceeded = $item_course->is_exceeded() ) <= 0 ) && ( $item_course->get_status() === 'enrolled' ) ) {
92
+ $item_course->finish();
93
 
94
+ $start_time = $item_course->get_start_time()->getTimestamp();
95
+ $duration = $item_course->get_course()->get_duration();
96
 
97
+ learn_press_update_user_item_meta( $item_course->get_user_item_id(), 'via', 'schedule' );
98
+ learn_press_update_user_item_meta( $item_course->get_user_item_id(), 'exceeded', $exceeded );
99
+ }
100
  }
 
101
 
102
+ remove_action( 'shutdown', array( $this, 'dispatch_queue' ) );
103
+ }
104
+ LP_Debug::instance()->add( 'Auto completing item', 'auto-complete-items', false, true );
105
 
106
  return false;
 
107
  }
108
 
109
  /**
115
  global $wpdb;
116
  $queued_items = get_transient( $this->transient_key );
117
  $queued_course_ids = $queued_items ? array_keys( $queued_items ) : false;
118
+ $queued_course_ids = array_unique( $queued_course_ids );
119
  $exclude_items = $queued_course_ids ? "AND user_item_id NOT IN(" . join( ',', $queued_course_ids ) . ")" : '';
120
 
121
  $null_time = '0000-00-00 00:00:00';
140
  $format = array_fill( 0, sizeof( $course_item_types ), '%s' );
141
  $args = $course_item_types;
142
  $new_items = array();
143
+ die();
144
  foreach ( $item_courses as $item_course ) {
145
  $new_items[ $item_course->user_item_id ] = array();
146
 
212
  wp_schedule_event( time() + 10, $this->cron_interval_identifier, $this->cron_hook_identifier );
213
  }
214
  }
215
+
216
+ /**
217
+ * @return LP_Background_Schedule_Items
218
+ */
219
+ public static function instance() {
220
+ return parent::instance();
221
+ }
222
  }
223
+ }
224
+ return LP_Background_Schedule_Items::instance();
inc/class-lp-ajax.php CHANGED
@@ -268,14 +268,13 @@ if ( ! class_exists( 'LP_AJAX' ) ) {
268
  if ( ! $user->get_id() || ! $course || ! wp_verify_nonce( $nonce, $nonce_action ) ) {
269
  wp_die( __( 'Access denied!', 'learnpress' ) );
270
  }
271
- //LP_Debug::startTransaction();
272
  $finished = $user->finish_course( $course_id );
273
- //LP_Debug::rollbackTransaction();
274
  $response = array(
275
  'redirect' => get_the_permalink( $course_id )
276
  );
277
 
278
  if ( $finished ) {
 
279
  learn_press_add_message( sprintf( __( 'You have finished this course "%s"', 'learnpress' ), $course->get_title() ) );
280
  $response['result'] = 'success';
281
  } else {
@@ -361,7 +360,7 @@ if ( ! class_exists( 'LP_AJAX' ) ) {
361
  if ( ! wp_verify_nonce( $security, $security_action ) ) {
362
  learn_press_add_message( __( 'Error! Invalid course or failed security check.', 'learnpress' ), 'error' );
363
  } else {
364
- if ( $user->can( 'retake-course', $course_id ) ) {
365
  if ( ! $result = $user->retake_course( $course_id ) ) {
366
  learn_press_add_message( __( 'Error!', 'learnpress' ), 'error' );
367
  } else {
268
  if ( ! $user->get_id() || ! $course || ! wp_verify_nonce( $nonce, $nonce_action ) ) {
269
  wp_die( __( 'Access denied!', 'learnpress' ) );
270
  }
 
271
  $finished = $user->finish_course( $course_id );
 
272
  $response = array(
273
  'redirect' => get_the_permalink( $course_id )
274
  );
275
 
276
  if ( $finished ) {
277
+ learn_press_update_user_item_meta( $finished, 'finishing_type', 'click' );
278
  learn_press_add_message( sprintf( __( 'You have finished this course "%s"', 'learnpress' ), $course->get_title() ) );
279
  $response['result'] = 'success';
280
  } else {
360
  if ( ! wp_verify_nonce( $security, $security_action ) ) {
361
  learn_press_add_message( __( 'Error! Invalid course or failed security check.', 'learnpress' ), 'error' );
362
  } else {
363
+ if ( $user->can_retake_course( $course_id ) ) {
364
  if ( ! $result = $user->retake_course( $course_id ) ) {
365
  learn_press_add_message( __( 'Error!', 'learnpress' ), 'error' );
366
  } else {
inc/class-lp-checkout.php CHANGED
@@ -105,6 +105,11 @@ class LP_Checkout {
105
 
106
  $order->set_meta( '_create_account', 'yes' );
107
  LP()->session->set( 'user_waiting_payment', $this->get_checkout_email() );
 
 
 
 
 
108
  break;
109
  }
110
 
105
 
106
  $order->set_meta( '_create_account', 'yes' );
107
  LP()->session->set( 'user_waiting_payment', $this->get_checkout_email() );
108
+
109
+ $user_id = $this->_create_account();
110
+ if ( ! is_wp_error( $user_id ) ) {
111
+ wp_new_user_notification( $user_id, null, apply_filters( 'learn-press/email-create-new-user-when-checkout', 'user' ) );
112
+ }
113
  break;
114
  }
115
 
inc/class-lp-debug.php CHANGED
@@ -39,10 +39,21 @@ class LP_Debug {
39
  add_action( 'plugins_loaded', array( $this, 'init' ) );
40
  }
41
 
 
 
 
42
  protected static $_current_name = '';
43
 
 
 
 
44
  protected $_lock = null;
45
 
 
 
 
 
 
46
  /**
47
  * Destructor.
48
  */
@@ -103,10 +114,15 @@ class LP_Debug {
103
  }
104
 
105
  $path = learn_press_get_log_file_path( $handle );
106
- $f = @fopen( $path, 'a' );
 
 
 
 
107
 
108
  if ( $f ) {
109
- if ( filesize( $path ) >= 1024 * 1024 * 1 ) {
 
110
  ftruncate( $f, 0 );
111
  }
112
  $this->_handles[ $handle ] = $f;
@@ -117,6 +133,17 @@ class LP_Debug {
117
  return false;
118
  }
119
 
 
 
 
 
 
 
 
 
 
 
 
120
  /**
121
  * Add a log entry to chosen file.
122
  *
@@ -134,19 +161,43 @@ class LP_Debug {
134
  $this->_lock = ! ( LP_Settings::instance()->get( 'debug' ) == 'yes' );
135
  }
136
 
 
137
  if ( ( ! $force && ! $this->_lock || $force ) && $this->_can_log( $handle ) ) {
138
  if ( $clear ) {
139
  $this->clear( $handle );
140
  }
141
- $time = date_i18n( 'm-d-Y @ H:i:s -' );
142
 
143
  if ( ! is_string( $message ) ) {
144
  ob_start();
145
  print_r( $message );
146
  $message = ob_get_clean();
147
  }
 
 
 
 
 
 
 
 
 
148
  try {
149
- fwrite( $this->_handles[ $handle ], "-----" . $time . "-----\n" . $message . "\n" );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  do_action( 'learn_press_log_add', $handle, $message );
151
  }
152
  catch ( Exception $ex ) {
@@ -250,7 +301,14 @@ class LP_Debug {
250
  */
251
  public static function startTransaction() {
252
  global $wpdb;
 
 
 
 
 
253
  $wpdb->query( "START TRANSACTION;" );
 
 
254
  }
255
 
256
  /**
@@ -258,7 +316,14 @@ class LP_Debug {
258
  */
259
  public static function rollbackTransaction() {
260
  global $wpdb;
 
 
 
 
 
261
  $wpdb->query( "ROLLBACK;" );
 
 
262
  }
263
 
264
  /**
@@ -266,7 +331,14 @@ class LP_Debug {
266
  */
267
  public static function commitTransaction() {
268
  global $wpdb;
 
 
 
 
 
269
  $wpdb->query( "COMMIT;" );
 
 
270
  }
271
 
272
  public static function log_function( $func ) {
39
  add_action( 'plugins_loaded', array( $this, 'init' ) );
40
  }
41
 
42
+ /**
43
+ * @var string
44
+ */
45
  protected static $_current_name = '';
46
 
47
+ /**
48
+ * @var null
49
+ */
50
  protected $_lock = null;
51
 
52
+ /**
53
+ * @var bool
54
+ */
55
+ protected static $_transaction_started = false;
56
+
57
  /**
58
  * Destructor.
59
  */
114
  }
115
 
116
  $path = learn_press_get_log_file_path( $handle );
117
+ if ( ! file_exists( $path ) ) {
118
+ $f = fopen( $path, 'w' );
119
+ fclose( $f );
120
+ }
121
+ $f = @fopen( $path, 'r+' );
122
 
123
  if ( $f ) {
124
+ // 3M
125
+ if ( filesize( $path ) >= 1024 * 1024 * 3 ) {
126
  ftruncate( $f, 0 );
127
  }
128
  $this->_handles[ $handle ] = $f;
133
  return false;
134
  }
135
 
136
+ private function close( $handle ) {
137
+ if ( isset( $this->_handles[ $handle ] ) ) {
138
+ @fclose( $this->_handles[ $handle ] );
139
+ unset( $this->_handles[ $handle ] );
140
+
141
+ return true;
142
+ }
143
+
144
+ return false;
145
+ }
146
+
147
  /**
148
  * Add a log entry to chosen file.
149
  *
161
  $this->_lock = ! ( LP_Settings::instance()->get( 'debug' ) == 'yes' );
162
  }
163
 
164
+
165
  if ( ( ! $force && ! $this->_lock || $force ) && $this->_can_log( $handle ) ) {
166
  if ( $clear ) {
167
  $this->clear( $handle );
168
  }
169
+ $time = date_i18n( 'm-d-Y @ H:i:s' );
170
 
171
  if ( ! is_string( $message ) ) {
172
  ob_start();
173
  print_r( $message );
174
  $message = ob_get_clean();
175
  }
176
+ $backtrace = debug_backtrace();
177
+ ob_start();
178
+ echo "\n\n";
179
+ foreach ( array( 'file', 'line', 'function', 'class' ) as $prop ) {
180
+ if ( isset( $backtrace[0][ $prop ] ) ) {
181
+ echo "=> " . str_pad( $prop, 10 ) . ':' . $backtrace[0][ $prop ] . "\n";
182
+ }
183
+ }
184
+ $message .= ob_get_clean();
185
  try {
186
+
187
+ $path = learn_press_get_log_file_path( $handle . '-temp' );
188
+ $f = @fopen( $path, 'a' );
189
+ fwrite( $f, "----------" . $time . "----------\n" . $message . "-----------------------------------------\n\n\n" );
190
+ fseek( $this->_handles[ $handle ], 0 );
191
+ while ( ( $buffer = fgets( $this->_handles[ $handle ], 4096 ) ) !== false ) {
192
+ fwrite( $f, $buffer );
193
+ }
194
+
195
+ fclose( $f );
196
+ $this->close( $handle );
197
+ unlink( learn_press_get_log_file_path( $handle ) );
198
+ rename( $path, learn_press_get_log_file_path( $handle ) );
199
+
200
+ //fwrite( $this->_handles[ $handle ], "----------" . $time . "----------\n" . $message . "\n--------------------" );
201
  do_action( 'learn_press_log_add', $handle, $message );
202
  }
203
  catch ( Exception $ex ) {
301
  */
302
  public static function startTransaction() {
303
  global $wpdb;
304
+
305
+ if ( self::$_transaction_started ) {
306
+ return;
307
+ }
308
+
309
  $wpdb->query( "START TRANSACTION;" );
310
+
311
+ self::$_transaction_started = true;
312
  }
313
 
314
  /**
316
  */
317
  public static function rollbackTransaction() {
318
  global $wpdb;
319
+
320
+ if ( ! self::$_transaction_started ) {
321
+ return;
322
+ }
323
+
324
  $wpdb->query( "ROLLBACK;" );
325
+
326
+ self::$_transaction_started = false;
327
  }
328
 
329
  /**
331
  */
332
  public static function commitTransaction() {
333
  global $wpdb;
334
+
335
+ if ( ! self::$_transaction_started ) {
336
+ return;
337
+ }
338
+
339
  $wpdb->query( "COMMIT;" );
340
+
341
+ self::$_transaction_started = false;
342
  }
343
 
344
  public static function log_function( $func ) {
inc/class-lp-emails.php CHANGED
@@ -35,13 +35,18 @@ if ( ! class_exists( 'LP_Emails' ) ) {
35
  /**
36
  * @var LP_Background_Emailer
37
  */
38
- protected static $_background_emailer = null;
39
 
40
  /**
41
  * @var LP_Email
42
  */
43
  protected $_current = null;
44
 
 
 
 
 
 
45
  /**
46
  * LP_Emails constructor.
47
  */
@@ -50,6 +55,27 @@ if ( ! class_exists( 'LP_Emails' ) ) {
50
  return;
51
  }
52
  include LP_PLUGIN_PATH . 'inc/emails/class-lp-email.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  include LP_PLUGIN_PATH . 'inc/emails/types/class-lp-email-type-order.php';
54
  include LP_PLUGIN_PATH . 'inc/emails/types/class-lp-email-type-enrolled-course.php';
55
  include LP_PLUGIN_PATH . 'inc/emails/types/class-lp-email-type-finished-course.php';
@@ -98,22 +124,6 @@ if ( ! class_exists( 'LP_Emails' ) ) {
98
  //$this->emails['LP_Email_User_Order_Changed_Status'] = include( 'emails/class-lp-email-user-order-changed-status.php' );
99
 
100
  //$this->emails['LP_Email_Enrolled_Course_Admin'] = include( 'emails/class-lp-email-enrolled-course-admin.php' );
101
-
102
- add_action( 'learn_press_course_submit_for_reviewer_notification', array( $this, 'review_course' ), 10, 2 );
103
- add_action( 'learn_press_course_submit_rejected_notification', array( $this, 'course_rejected' ), 10, 2 );
104
- add_action( 'learn_press_course_submit_approved_notification', array( $this, 'course_approved' ), 10, 2 );
105
- add_action( 'learn_press_user_finish_course_notification', array( $this, 'finish_course' ), 10, 3 );
106
- // Send email customer when order created
107
- add_filter( 'learn_press_checkout_success_result_notification', array(
108
- $this,
109
- 'customer_new_order'
110
- ), 10, 2 );
111
- add_action( 'set_user_role_notification', array( $this, 'become_an_teacher' ), 10, 3 );
112
-
113
- add_action( 'learn_press_email_header', array( $this, 'email_header' ) );
114
- add_action( 'learn_press_email_footer', array( $this, 'email_footer' ) );
115
-
116
- do_action( 'learn-press/emails-init', $this );
117
  }
118
 
119
 
@@ -174,7 +184,7 @@ if ( ! class_exists( 'LP_Emails' ) ) {
174
 
175
  if ( 'yes' === LP()->settings()->get( 'emails_general.send_email_background' ) ) {
176
 
177
- self::$_background_emailer = new LP_Background_Emailer();
178
 
179
  foreach ( $actions as $action ) {
180
  add_action( $action, array( __CLASS__, 'queue_email' ), 10, 10 );
@@ -201,7 +211,7 @@ if ( ! class_exists( 'LP_Emails' ) ) {
201
  'filter' => current_filter(),
202
  'args' => func_get_args(),
203
  );
204
- self::$_background_emailer->push_to_queue( $data_queue );
205
  }
206
 
207
  /**
@@ -313,6 +323,8 @@ if ( ! class_exists( 'LP_Emails' ) ) {
313
  }
314
 
315
  public function set_current( $id ) {
 
 
316
  if ( $id instanceof LP_Email ) {
317
  $this->_current = $id->id;
318
  } else {
@@ -320,10 +332,17 @@ if ( ! class_exists( 'LP_Emails' ) ) {
320
  }
321
  }
322
 
 
 
 
323
  public function get_current() {
324
  return self::get_email( $this->_current );
325
  }
326
 
 
 
 
 
327
  /**
328
  * @param string $id
329
  *
@@ -340,6 +359,25 @@ if ( ! class_exists( 'LP_Emails' ) ) {
340
  return ! empty( $emails[ $id ] ) ? self::instance()->emails[ $emails[ $id ] ] : false;
341
  }
342
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  /**
344
  * Main LP_Mail Instance, ensures only one instance of LP_Mail is loaded or can be loaded.
345
  *
35
  /**
36
  * @var LP_Background_Emailer
37
  */
38
+ //protected static $_background_emailer = null;
39
 
40
  /**
41
  * @var LP_Email
42
  */
43
  protected $_current = null;
44
 
45
+ /**
46
+ * @var null
47
+ */
48
+ protected $_last_current = null;
49
+
50
  /**
51
  * LP_Emails constructor.
52
  */
55
  return;
56
  }
57
  include LP_PLUGIN_PATH . 'inc/emails/class-lp-email.php';
58
+
59
+ $this->register_emails();
60
+
61
+ add_action( 'learn_press_course_submit_for_reviewer_notification', array( $this, 'review_course' ), 10, 2 );
62
+ add_action( 'learn_press_course_submit_rejected_notification', array( $this, 'course_rejected' ), 10, 2 );
63
+ add_action( 'learn_press_course_submit_approved_notification', array( $this, 'course_approved' ), 10, 2 );
64
+ add_action( 'learn_press_user_finish_course_notification', array( $this, 'finish_course' ), 10, 3 );
65
+ // Send email customer when order created
66
+ add_filter( 'learn_press_checkout_success_result_notification', array(
67
+ $this,
68
+ 'customer_new_order'
69
+ ), 10, 2 );
70
+ add_action( 'set_user_role_notification', array( $this, 'become_an_teacher' ), 10, 3 );
71
+
72
+ //add_action( 'learn_press_email_header', array( $this, 'email_header' ) );
73
+ //add_action( 'learn_press_email_footer', array( $this, 'email_footer' ) );
74
+
75
+ do_action( 'learn-press/emails-init', $this );
76
+ }
77
+
78
+ public function register_emails() {
79
  include LP_PLUGIN_PATH . 'inc/emails/types/class-lp-email-type-order.php';
80
  include LP_PLUGIN_PATH . 'inc/emails/types/class-lp-email-type-enrolled-course.php';
81
  include LP_PLUGIN_PATH . 'inc/emails/types/class-lp-email-type-finished-course.php';
124
  //$this->emails['LP_Email_User_Order_Changed_Status'] = include( 'emails/class-lp-email-user-order-changed-status.php' );
125
 
126
  //$this->emails['LP_Email_Enrolled_Course_Admin'] = include( 'emails/class-lp-email-enrolled-course-admin.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  }
128
 
129
 
184
 
185
  if ( 'yes' === LP()->settings()->get( 'emails_general.send_email_background' ) ) {
186
 
187
+ //self::$_background_emailer = new LP_Background_Emailer();
188
 
189
  foreach ( $actions as $action ) {
190
  add_action( $action, array( __CLASS__, 'queue_email' ), 10, 10 );
211
  'filter' => current_filter(),
212
  'args' => func_get_args(),
213
  );
214
+ LP()->background( 'emailer' )->push_to_queue( $data_queue );
215
  }
216
 
217
  /**
323
  }
324
 
325
  public function set_current( $id ) {
326
+ $this->_last_current = $this->_current;
327
+
328
  if ( $id instanceof LP_Email ) {
329
  $this->_current = $id->id;
330
  } else {
332
  }
333
  }
334
 
335
+ /**
336
+ * @return bool|LP_Email
337
+ */
338
  public function get_current() {
339
  return self::get_email( $this->_current );
340
  }
341
 
342
+ public function reset_current() {
343
+ $this->_current = $this->_last_current;
344
+ }
345
+
346
  /**
347
  * @param string $id
348
  *
359
  return ! empty( $emails[ $id ] ) ? self::instance()->emails[ $emails[ $id ] ] : false;
360
  }
361
 
362
+ /**
363
+ * Get image header in general settings.
364
+ *
365
+ * @return string
366
+ */
367
+ public function get_image_header() {
368
+ $image = LP()->settings->get( 'emails_general.header_image' );
369
+
370
+ if ( is_array( $image ) ) {
371
+ $image = reset( $image );
372
+ }
373
+
374
+ if ( is_numeric( $image ) ) {
375
+ $image = wp_get_attachment_image_url( $image, 'full' );
376
+ }
377
+
378
+ return $image;
379
+ }
380
+
381
  /**
382
  * Main LP_Mail Instance, ensures only one instance of LP_Mail is loaded or can be loaded.
383
  *
inc/class-lp-forms-handler.php CHANGED
@@ -158,7 +158,7 @@ class LP_Forms_Handler {
158
 
159
  learn_press_maybe_send_json( $result, 'learn_press_print_messages' );
160
 
161
- if ( ( $result['result'] === 'success' ) && $redirect = LP_Request::get_redirect( learn_press_get_current_url() ) ) {
162
  wp_redirect( $redirect );
163
  exit();
164
  }
158
 
159
  learn_press_maybe_send_json( $result, 'learn_press_print_messages' );
160
 
161
+ if ( ( $result['result'] === 'success' ) && $redirect = LP_Request::get( 'redirect_to' ) ) {
162
  wp_redirect( $redirect );
163
  exit();
164
  }
inc/class-lp-install.php CHANGED
@@ -87,6 +87,9 @@ if ( ! function_exists( 'LP_Install' ) ) {
87
  return;
88
  }
89
 
 
 
 
90
  if ( isset( $_REQUEST['test-upgrade'] ) ) {
91
  $ver = $_REQUEST['test-upgrade'];
92
  if ( ! empty( self::$_update_files[ $ver ] ) ) {
@@ -94,6 +97,7 @@ if ( ! function_exists( 'LP_Install' ) ) {
94
  }
95
  }
96
 
 
97
  if ( ! self::$_update_files ) {
98
  return;
99
  }
@@ -101,20 +105,20 @@ if ( ! function_exists( 'LP_Install' ) ) {
101
  // Get versions
102
  $versions = array_keys( self::$_update_files );
103
  $latest_ver = end( $versions );
104
-
105
  $db_version = get_option( 'learnpress_db_version' );
106
 
107
  // Check latest version with the value updated in db
108
- if ( !$db_version || version_compare( $db_version, LEARNPRESS_VERSION, '>=' ) ) {
109
  return;
110
  }
111
 
112
- if(version_compare($latest_ver, LEARNPRESS_VERSION)){
113
- return;
114
- }
 
115
 
116
  // Show message if the latest version is not already updated
117
- add_action( 'admin_notices', array( __CLASS__, 'check_update_message' ) );
118
  }
119
 
120
  /**
@@ -133,6 +137,7 @@ if ( ! function_exists( 'LP_Install' ) ) {
133
  self::_create_cron_jobs();
134
  self::_delete_transients();
135
  self::_create_log_path();
 
136
  ///self::_create_pages();
137
  delete_transient( 'lp_upgraded_30' );
138
  $current_version = get_option( 'learnpress_version', null );
@@ -159,6 +164,18 @@ if ( ! function_exists( 'LP_Install' ) ) {
159
  }
160
  }
161
 
 
 
 
 
 
 
 
 
 
 
 
 
162
 
163
  /**
164
  * Update default options for LP
@@ -681,6 +698,8 @@ if ( ! function_exists( 'LP_Install' ) ) {
681
  public static function update_db_version( $version = null ) {
682
  delete_option( 'learnpress_db_version' );
683
  update_option( 'learnpress_db_version', is_null( $version ) ? LEARNPRESS_VERSION : $version );
 
 
684
  }
685
 
686
  public static function update_version( $version = null ) {
@@ -852,8 +871,4 @@ if ( ! function_exists( 'LP_Install' ) ) {
852
  }
853
 
854
  LP_Install::init();
855
- }
856
-
857
- if ( isset( $_REQUEST['xxxxx'] ) ) {
858
- add_action( 'plugins_loaded', array( 'LP_Install', 'create_options' ) );
859
  }
87
  return;
88
  }
89
 
90
+ /**
91
+ * For test upgrade
92
+ */
93
  if ( isset( $_REQUEST['test-upgrade'] ) ) {
94
  $ver = $_REQUEST['test-upgrade'];
95
  if ( ! empty( self::$_update_files[ $ver ] ) ) {
97
  }
98
  }
99
 
100
+ // There is no file to update
101
  if ( ! self::$_update_files ) {
102
  return;
103
  }
105
  // Get versions
106
  $versions = array_keys( self::$_update_files );
107
  $latest_ver = end( $versions );
 
108
  $db_version = get_option( 'learnpress_db_version' );
109
 
110
  // Check latest version with the value updated in db
111
+ if ( ! $db_version || version_compare( $db_version, $latest_ver, '>=' ) ) {
112
  return;
113
  }
114
 
115
+ // // If version to update is less than in db
116
+ // if ( version_compare( $latest_ver, $db_version, '<' ) ) {
117
+ // return;
118
+ // }
119
 
120
  // Show message if the latest version is not already updated
121
+ add_action( 'admin_notices', array( __CLASS__, 'check_update_message' ), 20 );
122
  }
123
 
124
  /**
137
  self::_create_cron_jobs();
138
  self::_delete_transients();
139
  self::_create_log_path();
140
+ self::_clear_backgrounds();
141
  ///self::_create_pages();
142
  delete_transient( 'lp_upgraded_30' );
143
  $current_version = get_option( 'learnpress_version', null );
164
  }
165
  }
166
 
167
+ protected static function _clear_backgrounds() {
168
+ global $wpdb;
169
+ $query = $wpdb->prepare( "
170
+ DELETE FROM {$wpdb->options} WHERE option_name LIKE %s
171
+ ", $wpdb->esc_like( 'lp_schedule_items_batch_' ) . '%' );
172
+ $wpdb->query( $query );
173
+
174
+ $query = $wpdb->prepare( "
175
+ DELETE FROM {$wpdb->options} WHERE option_name LIKE %s
176
+ ", $wpdb->esc_like( 'lp_installer_batch_' ) . '%' );
177
+ $wpdb->query( $query );
178
+ }
179
 
180
  /**
181
  * Update default options for LP
698
  public static function update_db_version( $version = null ) {
699
  delete_option( 'learnpress_db_version' );
700
  update_option( 'learnpress_db_version', is_null( $version ) ? LEARNPRESS_VERSION : $version );
701
+
702
+ LP_Debug::instance()->add( debug_backtrace(), 'update_db_version', false, true );
703
  }
704
 
705
  public static function update_version( $version = null ) {
871
  }
872
 
873
  LP_Install::init();
 
 
 
 
874
  }
inc/class-lp-market-products.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class LP_Market_Products {
4
+ public function __construct() {
5
+
6
+ add_filter( 'tpl-market-products', array( $this, 'market_products' ) );
7
+
8
+ }
9
+
10
+ public function market_products( $products = array() ) {
11
+ $products['learnpress'] = array(
12
+ 'name' => __( 'LearnPress', 'learnpress' ),
13
+ 'desc' => __( 'Ahihi', 'learnpress' ),
14
+ 'priority' => 5,
15
+ 'items' => array(
16
+ array(
17
+ 'name' => 'LearnPress Course Review',
18
+ 'slug' => 'learnpress-course-review',
19
+ 'required' => false,
20
+ 'version' => '2.0',
21
+ 'description' => 'Adding review for course By ThimPress.',
22
+ 'add-on' => true,
23
+ ),
24
+ array(
25
+ 'name' => 'LearnPress Gradebook',
26
+ 'slug' => 'learnpress-gradebook',
27
+ 'required' => false,
28
+ 'version' => '2.0',
29
+ 'premium' => true,
30
+ 'description' => 'Adding review for course By ThimPress.',
31
+ 'add-on' => true,
32
+ ),
33
+ )
34
+ );
35
+
36
+ return $products;
37
+ }
38
+ }
39
+
40
+ return new LP_Market_Products();
inc/class-lp-page-controller.php CHANGED
@@ -252,6 +252,7 @@ class LP_Page_Controller {
252
  $this->_load_archive_courses( $template );
253
  }
254
  }
 
255
  return $template;
256
  }
257
 
@@ -440,12 +441,8 @@ class LP_Page_Controller {
440
 
441
  if ( LEARNPRESS_IS_COURSES || LEARNPRESS_IS_TAG || LEARNPRESS_IS_CATEGORY || LEARNPRESS_IS_SEARCH || LEARNPRESS_IS_TAX ) {
442
  global $wp_query;
443
- if ( is_callable( 'clone' ) ) {
444
- LP()->wp_query = clone( $wp_query );
445
- } else {
446
- // PHP 7
447
- LP()->wp_query = clone $wp_query;
448
- }
449
 
450
  $template = get_page_template();
451
 
252
  $this->_load_archive_courses( $template );
253
  }
254
  }
255
+
256
  return $template;
257
  }
258
 
441
 
442
  if ( LEARNPRESS_IS_COURSES || LEARNPRESS_IS_TAG || LEARNPRESS_IS_CATEGORY || LEARNPRESS_IS_SEARCH || LEARNPRESS_IS_TAX ) {
443
  global $wp_query;
444
+ // PHP 7
445
+ LP()->wp_query = clone $wp_query;
 
 
 
 
446
 
447
  $template = get_page_template();
448
 
inc/class-lp-query.php CHANGED
@@ -285,6 +285,7 @@ class LP_Query {
285
  * @param WP_Query $q
286
  */
287
  public function query_taxonomy( $q ) {
 
288
  // We only want to affect the main query
289
  if ( ! $q->is_main_query() ) {
290
  return;
285
  * @param WP_Query $q
286
  */
287
  public function query_taxonomy( $q ) {
288
+
289
  // We only want to affect the main query
290
  if ( ! $q->is_main_query() ) {
291
  return;
inc/class-lp-request-handler.php CHANGED
@@ -250,11 +250,22 @@ class LP_Request {
250
  */
251
  public static function do_checkout( $course_id, $cart_id, $action ) {
252
 
 
253
  $course = learn_press_get_course( $course_id );
254
  if ( ! $course ) {
255
  return false;
256
  }
257
-
 
 
 
 
 
 
 
 
 
 
258
  $cart = LP()->cart;
259
 
260
  if ( ! $cart->get_items() ) {
@@ -298,24 +309,30 @@ class LP_Request {
298
 
299
  $user = LP_Global::user();
300
  $redirect = get_the_permalink( $course_id );
301
- $thing = $user->enroll( $course_id, $order_id );
302
-
303
- if ( is_wp_error( $thing ) ) {
304
- learn_press_add_message(
305
- $thing->get_error_message(),
306
- 'error'
307
- );
308
-
309
- if ( $thing->get_error_code() == 10002 ) {
310
- $redirect = apply_filters( 'learn-press/enroll-course-redirect-login', learn_press_get_login_url( add_query_arg( 'enroll-course', $course_id, $redirect ) ) );
311
- }
312
- } elseif ( $thing ) {
313
- learn_press_add_message(
314
- sprintf( __( 'Congrats! You have enrolled &quot;%s&quot', 'learnpress' ), get_the_title( $course_id ) ),
315
- 'success'
316
- );
 
 
 
 
 
 
 
317
  }
318
-
319
  wp_redirect( apply_filters( 'learn-press/enroll-course-redirect', $redirect ) );
320
  exit();
321
  }
250
  */
251
  public static function do_checkout( $course_id, $cart_id, $action ) {
252
 
253
+ $user = learn_press_get_current_user();
254
  $course = learn_press_get_course( $course_id );
255
  if ( ! $course ) {
256
  return false;
257
  }
258
+
259
+ if( 'enroll-course' == $action){
260
+ if(!$user->can_enroll_course($course_id)){
261
+ learn_press_add_message(
262
+ sprintf( __( 'You can not enroll course &quot;%s&quot', 'learnpress' ), get_the_title( $course_id ) ),
263
+ 'error'
264
+ );
265
+ return false;
266
+ }
267
+ }
268
+
269
  $cart = LP()->cart;
270
 
271
  if ( ! $cart->get_items() ) {
309
 
310
  $user = LP_Global::user();
311
  $redirect = get_the_permalink( $course_id );
312
+ if ( !$user->can_enroll_course( $course_id ) && 'enroll-course' == $action ){
313
+ learn_press_add_message(
314
+ sprintf( __( 'You can not enroll course &quot;%s&quot', 'learnpress' ), get_the_title( $course_id ) ),
315
+ 'error'
316
+ );
317
+ } else {
318
+ $thing = $user->enroll( $course_id, $order_id );
319
+
320
+ if ( is_wp_error( $thing ) ) {
321
+ learn_press_add_message(
322
+ $thing->get_error_message(),
323
+ 'error'
324
+ );
325
+
326
+ if ( $thing->get_error_code() == 10002 ) {
327
+ $redirect = apply_filters( 'learn-press/enroll-course-redirect-login', learn_press_get_login_url( add_query_arg( 'enroll-course', $course_id, $redirect ) ) );
328
+ }
329
+ } elseif ( $thing ) {
330
+ learn_press_add_message(
331
+ sprintf( __( 'Congrats! You have enrolled &quot;%s&quot', 'learnpress' ), get_the_title( $course_id ) ),
332
+ 'success'
333
+ );
334
+ }
335
  }
 
336
  wp_redirect( apply_filters( 'learn-press/enroll-course-redirect', $redirect ) );
337
  exit();
338
  }
inc/class-lp-schedules.php CHANGED
@@ -17,13 +17,14 @@ class LP_Schedules {
17
  */
18
  public function __construct() {
19
 
20
- $this->background_schedule_items = new LP_Background_Schedule_Items();
21
 
22
  if ( learn_press_get_request( 'action' ) == 'heartbeat' || ! is_admin() ) {
23
  //$this->_update_user_course_expired();
24
  }
25
- add_filter( 'template_include', array( $this, 'queue_items' ), 10 );
26
- add_filter( 'cron_schedules', array( $this, 'add_custom_cron_intervals' ), 10, 1 );
 
27
 
28
  return;
29
  if ( ! wp_next_scheduled( 'learn_press_schedule_update_user_items' ) ) {
@@ -60,13 +61,10 @@ class LP_Schedules {
60
  *
61
  * @return mixed
62
  */
63
- public function queue_items( $template ) {
64
-
65
- $this->background_schedule_items->push_to_queue(
66
- array( 'auto-complete-item' => rand() )
67
- );
68
 
69
- return $template;
70
  if ( ! $items = $this->_get_items() ) {
71
  return $template;
72
  }
17
  */
18
  public function __construct() {
19
 
20
+ //$this->background_schedule_items = new LP_Background_Schedule_Items();
21
 
22
  if ( learn_press_get_request( 'action' ) == 'heartbeat' || ! is_admin() ) {
23
  //$this->_update_user_course_expired();
24
  }
25
+ //add_filter( 'init', array( $this, 'queue_items' ), 10 );
26
+
27
+ // add_filter( 'cron_schedules', array( $this, 'add_custom_cron_intervals' ), 10, 1 );
28
 
29
  return;
30
  if ( ! wp_next_scheduled( 'learn_press_schedule_update_user_items' ) ) {
61
  *
62
  * @return mixed
63
  */
64
+ public function queue_items() {
65
+ LP()->add_background_task( array( 'auto-complete-item' => rand() ), 'schedule-items' );
 
 
 
66
 
67
+ return false;
68
  if ( ! $items = $this->_get_items() ) {
69
  return $template;
70
  }
inc/class-lp-session-handler.php CHANGED
@@ -320,12 +320,17 @@ class LP_Session_Handler implements ArrayAccess {
320
  * Remove a value from session by key.
321
  *
322
  * @param string $key
 
323
  */
324
- public function remove( $key ) {
325
  if ( ! array_key_exists( $key, $this->_data ) ) {
326
  return;
327
  }
328
  unset( $this->_data[ $key ] );
 
 
 
 
329
  }
330
 
331
  /**
@@ -347,11 +352,16 @@ class LP_Session_Handler implements ArrayAccess {
347
  *
348
  * @param string $key
349
  * @param mixed $value
 
350
  */
351
- public function set( $key, $value ) {
352
  if ( $value !== $this->get( $key ) ) {
353
  $this->_data[ sanitize_key( $key ) ] = maybe_serialize( $value );
354
  $this->_changed = true;
 
 
 
 
355
  }
356
  }
357
 
320
  * Remove a value from session by key.
321
  *
322
  * @param string $key
323
+ * @param bool $force_change
324
  */
325
+ public function remove( $key, $force_change = false ) {
326
  if ( ! array_key_exists( $key, $this->_data ) ) {
327
  return;
328
  }
329
  unset( $this->_data[ $key ] );
330
+ $this->_changed = true;
331
+ if ( $force_change ) {
332
+ $this->save_data();
333
+ }
334
  }
335
 
336
  /**
352
  *
353
  * @param string $key
354
  * @param mixed $value
355
+ * @param bool $force_change
356
  */
357
+ public function set( $key, $value, $force_change = false ) {
358
  if ( $value !== $this->get( $key ) ) {
359
  $this->_data[ sanitize_key( $key ) ] = maybe_serialize( $value );
360
  $this->_changed = true;
361
+
362
+ if ( $force_change ) {
363
+ $this->save_data();
364
+ }
365
  }
366
  }
367
 
inc/course/abstract-course.php CHANGED
@@ -181,7 +181,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
181
 
182
  break;
183
  case 'current_lesson':
184
- $lesson_id = ( ( $lesson_id = learn_press_get_request( "lesson_id" ) ) && $this->has( 'item', $lesson_id ) ) ? $lesson_id : null;
185
  if ( $lesson_id ) {
186
  $value = LP_Lesson::get_lesson( $lesson_id );
187
  }
@@ -794,6 +794,8 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
794
  * @throws Exception
795
  */
796
  public function has( $tag ) {
 
 
797
  $args = func_get_args();
798
  unset( $args[0] );
799
  $method = 'has_' . preg_replace( '!-!', '_', $tag );
@@ -812,6 +814,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
812
  * @throws Exception
813
  */
814
  public function is( $tag ) {
 
815
  $args = func_get_args();
816
  unset( $args[0] );
817
  $method = 'is_' . preg_replace( '!-!', '_', $tag );
@@ -929,6 +932,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
929
  $item = false;
930
  if ( $this->has_item( $item_id ) ) {
931
  $item = LP_Course_Item::get_item( $item_id );
 
932
  }
933
 
934
  return apply_filters( 'learn-press/course-item', $item, $item_id, $this->get_id() );
@@ -1535,6 +1539,15 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
1535
  $this->_set_data( 'final_quiz', $id );
1536
  }
1537
 
 
 
 
 
 
 
 
 
 
1538
  /**
1539
  * Calculate results of course by final quiz
1540
  *
@@ -1733,7 +1746,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
1733
  $root_url = trailingslashit( get_home_url() );
1734
  if ( $items ) {
1735
  foreach ( $items as $k => $item ) {
1736
- if ( ( $view = $user->can( 'view-item', $item['id'], $this->get_id() ) ) !== false ) {
1737
  $status = $user->get_item_status( $item['id'], $this->get_id() );
1738
  $items[ $k ]['url'] = str_replace( $root_url, '', $this->get_item_link( $item['id'] ) );
1739
  $items[ $k ]['status'] = ( $status == 'completed' && $item['type'] == LP_QUIZ_CPT ) ? $user->get_quiz_graduation( $item['id'], $this->get_id() ) : $status;
181
 
182
  break;
183
  case 'current_lesson':
184
+ $lesson_id = ( ( $lesson_id = learn_press_get_request( "lesson_id" ) ) && $this->has_item( $lesson_id ) ) ? $lesson_id : null;
185
  if ( $lesson_id ) {
186
  $value = LP_Lesson::get_lesson( $lesson_id );
187
  }
794
  * @throws Exception
795
  */
796
  public function has( $tag ) {
797
+ _deprecated_function( __FUNCTION__, '3.0.8' );
798
+
799
  $args = func_get_args();
800
  unset( $args[0] );
801
  $method = 'has_' . preg_replace( '!-!', '_', $tag );
814
  * @throws Exception
815
  */
816
  public function is( $tag ) {
817
+ _deprecated_function( __FUNCTION__, '3.0.8' );
818
  $args = func_get_args();
819
  unset( $args[0] );
820
  $method = 'is_' . preg_replace( '!-!', '_', $tag );
932
  $item = false;
933
  if ( $this->has_item( $item_id ) ) {
934
  $item = LP_Course_Item::get_item( $item_id );
935
+ $item->set_course( $this );
936
  }
937
 
938
  return apply_filters( 'learn-press/course-item', $item, $item_id, $this->get_id() );
1539
  $this->_set_data( 'final_quiz', $id );
1540
  }
1541
 
1542
+ /**
1543
+ * Return TRUE if option to block course's items after course is exceeded turn on.
1544
+ *
1545
+ * @return bool
1546
+ */
1547
+ public function is_block_item_content() {
1548
+ return $this->get_data( 'block_lesson_content' ) === 'yes';
1549
+ }
1550
+
1551
  /**
1552
  * Calculate results of course by final quiz
1553
  *
1746
  $root_url = trailingslashit( get_home_url() );
1747
  if ( $items ) {
1748
  foreach ( $items as $k => $item ) {
1749
+ if ( ( $view = $user->can_view_item( $item['id'], $this->get_id() ) ) !== false ) {
1750
  $status = $user->get_item_status( $item['id'], $this->get_id() );
1751
  $items[ $k ]['url'] = str_replace( $root_url, '', $this->get_item_link( $item['id'] ) );
1752
  $items[ $k ]['status'] = ( $status == 'completed' && $item['type'] == LP_QUIZ_CPT ) ? $user->get_quiz_graduation( $item['id'], $this->get_id() ) : $status;
inc/course/class-lp-course-item.php CHANGED
@@ -47,6 +47,11 @@ if ( ! class_exists( 'LP_Course_Item' ) ) {
47
  */
48
  protected $_content = null;
49
 
 
 
 
 
 
50
  /**
51
  * LP_Course_Item constructor.
52
  *
@@ -78,17 +83,27 @@ if ( ! class_exists( 'LP_Course_Item' ) ) {
78
  * @return bool
79
  */
80
  public function is_preview( $context = 'display' ) {
81
- $is_preview = get_post_meta( $this->get_id(), '_lp_preview', true ) == 'yes';
 
82
 
83
- if ( $course = $this->get_course() ) {
84
- $user = learn_press_get_current_user();
 
 
 
85
 
86
- if ( $user->has_enrolled_course( $course->get_id() ) ) {
87
- $is_preview = false;
 
 
 
 
 
88
  }
 
89
  }
90
 
91
- return $context === 'display' ? apply_filters( 'learn-press/course-item-preview', $is_preview, $this->get_id() ) : $is_preview;
92
  }
93
 
94
  /**
@@ -135,81 +150,87 @@ if ( ! class_exists( 'LP_Course_Item' ) ) {
135
  public function get_class( $more = '', $user_id = 0 ) {
136
  global $lp_course_item;
137
 
138
- if ( ! $user_id ) {
139
- $user_id = get_current_user_id();
140
- }
141
 
142
- $defaults = array(
143
- 'course-item',
144
- 'course-item-' . $this->get_item_type(),
145
- 'course-item-' . $this->get_id()
146
- );
147
 
148
- if ( ( 'standard' !== ( $post_format = $this->get_format() ) ) && $post_format ) {
149
- $defaults[] = 'course-item-type-' . $post_format;
150
- }
 
 
151
 
152
- if ( $lp_course_item && $lp_course_item->get_id() == $this->get_id() ) {
153
- $defaults[] = 'current';
154
- }
155
 
156
- if ( is_array( $more ) ) {
157
- $defaults = array_merge( $defaults, $more );
158
- } else {
159
- $defaults[] = $more;
160
- }
161
 
162
- $course_id = 0;
163
- $enrolled = false;
164
- if ( $this->is_preview() ) {
165
- $defaults[] = 'item-preview';
166
- $defaults[] = 'has-status';
167
- } elseif ( $this->is_blocked() ) {
168
- $defaults[] = 'item-locked';
169
- } else {
170
- if ( $course = $this->get_course() ) {
171
- $course_id = $course->get_id();
172
- if ( $course->is_free() && ! $course->is_required_enroll() ) {
173
- $defaults[] = 'item-free';
174
- } else {
175
- if ( $user = learn_press_get_user( $user_id, ! $user_id ) ) {
176
- if ( $enrolled = $user->has_enrolled_course( $course_id ) ) {
177
- $item_status = $user->get_item_status( $this->get_id(), $course_id );
178
- $item_grade = $user->get_item_grade( $this->get_id(), $course_id );
179
-
180
- if ( $item_status ) {
181
- $defaults[] = 'has-status';
182
- $defaults[] = 'status-' . $item_status;
183
- }
184
- switch ( $item_status ) {
185
- case 'started':
186
- break;
187
- case 'completed':
188
- $defaults[] = $item_grade;
189
- break;
190
- default:
191
- if ( $item_class = apply_filters( 'learn-press/course-item-status-class', $item_status, $item_grade, $this->get_item_type(), $this->get_id(), $course_id ) ) {
192
- $defaults[] = $item_class;
193
- }
 
 
 
 
 
 
 
194
  }
195
  }
 
 
 
196
  }
197
- if ( ! $enrolled ) {
198
- $defaults[] = 'item-locked';
199
- }
200
  }
201
- } else {
202
- $defaults[] = 'item-locked';
203
  }
204
- }
 
 
 
 
 
205
 
206
- $classes = apply_filters( 'learn-press/course-item-class', $defaults, $this->get_item_type(), $this->get_id(), $course_id );
 
207
 
208
- // Filter unwanted values
209
- $classes = is_array( $classes ) ? $classes : explode( ' ', $classes );
210
- $classes = array_filter( $classes );
211
- $classes = array_unique( $classes );
212
- return $classes;
213
  }
214
 
215
  /**
@@ -229,7 +250,7 @@ if ( ! class_exists( 'LP_Course_Item' ) ) {
229
  /**
230
  * Set course parent of this item.
231
  *
232
- * @param LP_Course|int $course
233
  */
234
  public function set_course( $course ) {
235
  if ( is_numeric( $course ) ) {
@@ -265,12 +286,12 @@ if ( ! class_exists( 'LP_Course_Item' ) ) {
265
  /**
266
  * Get instance of an item from post
267
  *
268
- * @param WP_Post|int $post
 
269
  *
270
  * @return LP_Course_Item
271
  */
272
- public static function get_item( $post ) {
273
- $item = false;
274
  $item_type = '';
275
  $item_id = 0;
276
 
@@ -283,30 +304,38 @@ if ( ! class_exists( 'LP_Course_Item' ) ) {
283
  $item_id = $post->ID;
284
  }
285
 
286
- if ( $item_type ) {
287
- if ( learn_press_is_support_course_item_type( $item_type ) ) {
288
- $type = str_replace( 'lp_', '', $item_type );
289
 
290
- $class = apply_filters( 'learn-press/course-item-object-class', false, $type, $item_type, $item_id );
 
 
291
 
292
- if ( is_string( $class ) && class_exists( $class ) ) {
293
- $item = new $class( $post->ID, $post );
294
- } elseif ( $class instanceof LP_Course_Item ) {
295
- $item = $class;
296
- }
297
 
298
- if ( ! $item ) {
 
 
 
 
299
 
300
- switch ( $type ) {
301
- case 'lesson':
302
- $item = LP_Lesson::get_lesson( $item_id );
303
- break;
304
- case 'quiz':
305
- $item = LP_Quiz::get_quiz( $item_id );
306
- break;
 
 
 
307
  }
308
  }
309
  }
 
 
 
 
 
310
  }
311
 
312
  return apply_filters( 'learn-press/get-course-item', $item, $item_type, $item_id );
@@ -437,7 +466,6 @@ if ( ! class_exists( 'LP_Course_Item' ) ) {
437
 
438
  if ( $item_status ) {
439
  $status_classes[] = 'course-item-status';
440
- ///$status_classes[] = 'has-status';
441
  $status_classes[] = 'item-' . $item_status;
442
  }
443
  switch ( $item_status ) {
@@ -478,43 +506,118 @@ if ( ! class_exists( 'LP_Course_Item' ) ) {
478
  * @return bool
479
  */
480
  public function is_blocked( $course_id = 0, $user_id = 0 ) {
 
 
 
481
 
482
- if ( $course_id ) {
483
- $course = learn_press_get_course( $course_id );
484
- } else {
485
- $course = $this->get_course();
486
- $course_id = $course ? $course->get_id() : 0;
487
  }
488
 
489
- if ( ! $user_id ) {
490
- $user_id = get_current_user_id();
 
 
491
  }
492
 
493
- $user = learn_press_get_user( $user_id );
494
 
495
- if ( ! $course ) {
496
- $blocked = true;
497
- } else if ( ! $course->is_required_enroll() || $this->is_preview() ) {
498
- $blocked = false;
499
- } else {
500
- if ( $user ) {
501
- if ( $is_admin = in_array( 'administrator', $user->get_roles() ) ) {
502
- $blocked = false;
503
- } else if ( $user->has_course_status( $course_id, array( 'enrolled', 'finished' ) ) ) {
504
- $blocked = false;
505
- $course_item = $user->get_course_data( $course_id );
506
- if ( 'yes' === $course->get_data( 'block_lesson_content' ) && $course_item->is_exceeded() < 0 ) {
507
- $blocked = true;
508
- }
 
 
 
 
 
 
 
509
  } else {
510
- $blocked = true;
511
  }
512
- } else {
513
- $blocked = true;
514
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
515
  }
516
 
517
- return apply_filters( 'learn-press/course-item/is-blocked', $blocked, $this->get_id(), $course_id, $user_id );
518
  }
519
 
520
  public function offsetExists( $offset ) {
47
  */
48
  protected $_content = null;
49
 
50
+ /**
51
+ * @var bool
52
+ */
53
+ protected $_preview = '';
54
+
55
  /**
56
  * LP_Course_Item constructor.
57
  *
83
  * @return bool
84
  */
85
  public function is_preview( $context = 'display' ) {
86
+ if ( '' === $this->_preview ) {
87
+ $is_preview = get_post_meta( $this->get_id(), '_lp_preview', true ) == 'yes';
88
 
89
+ if ( $course = $this->get_course() ) {
90
+ $user_id = get_current_user_id();
91
+
92
+ if ( false === ( $cached = wp_cache_get( 'item-' . $user_id . '-' . $course->get_id() . '-' . $this->get_id(), 'lp-preview-items' ) ) ) {
93
+ $user = learn_press_get_current_user();
94
 
95
+ if ( $user->has_enrolled_course( $course->get_id() ) ) {
96
+ $is_preview = false;
97
+ }
98
+ wp_cache_set( 'item-' . $user_id . '-' . $course->get_id() . '-' . $this->get_id(), $is_preview ? 'yes' : 'no', 'lp-preview-items' );
99
+ } else {
100
+ $is_preview = $cached === 'yes' ? true : false;
101
+ }
102
  }
103
+ $this->_preview = $is_preview;
104
  }
105
 
106
+ return $context === 'display' ? apply_filters( 'learn-press/course-item-preview', $this->_preview, $this->get_id() ) : $this->_preview;
107
  }
108
 
109
  /**
150
  public function get_class( $more = '', $user_id = 0 ) {
151
  global $lp_course_item;
152
 
153
+ $course_id = get_the_ID();
 
 
154
 
155
+ if ( false === ( $classes = wp_cache_get( 'item-' . $user_id . '-' . $this->get_id(), 'lp-post-classes' ) ) ) {
156
+ if ( ! $user_id ) {
157
+ $user_id = get_current_user_id();
158
+ }
 
159
 
160
+ $defaults = array(
161
+ 'course-item',
162
+ 'course-item-' . $this->get_item_type(),
163
+ 'course-item-' . $this->get_id()
164
+ );
165
 
166
+ if ( ( 'standard' !== ( $post_format = $this->get_format() ) ) && $post_format ) {
167
+ $defaults[] = 'course-item-type-' . $post_format;
168
+ }
169
 
170
+ if ( $lp_course_item && $lp_course_item->get_id() == $this->get_id() ) {
171
+ $defaults[] = 'current';
172
+ }
 
 
173
 
174
+ if ( is_array( $more ) ) {
175
+ $defaults = array_merge( $defaults, $more );
176
+ } else {
177
+ $defaults[] = $more;
178
+ }
179
+ $course_id = 0;
180
+ $enrolled = false;
181
+
182
+ if ( $this->is_preview() ) {
183
+ $defaults[] = 'item-preview';
184
+ $defaults[] = 'has-status';
185
+ } elseif ( $this->is_blocked() ) {
186
+ $defaults[] = 'item-locked';
187
+ } else {
188
+ if ( $course = $this->get_course() ) {
189
+ $course_id = $course->get_id();
190
+ if ( $course->is_free() && ! $course->is_required_enroll() ) {
191
+ $defaults[] = 'item-free';
192
+ } else {
193
+ if ( $user = learn_press_get_user( $user_id, ! $user_id ) ) {
194
+ if ( $enrolled = $user->has_enrolled_course( $course_id ) ) {
195
+ $item_status = $user->get_item_status( $this->get_id(), $course_id );
196
+ $item_grade = $user->get_item_grade( $this->get_id(), $course_id );
197
+
198
+ if ( $item_status ) {
199
+ $defaults[] = 'has-status';
200
+ $defaults[] = 'status-' . $item_status;
201
+ }
202
+ switch ( $item_status ) {
203
+ case 'started':
204
+ break;
205
+ case 'completed':
206
+ $defaults[] = $item_grade;
207
+ break;
208
+ default:
209
+ if ( $item_class = apply_filters( 'learn-press/course-item-status-class', $item_status, $item_grade, $this->get_item_type(), $this->get_id(), $course_id ) ) {
210
+ $defaults[] = $item_class;
211
+ }
212
+ }
213
  }
214
  }
215
+ if ( ! $enrolled ) {
216
+ $defaults[] = 'item-locked';
217
+ }
218
  }
219
+ } else {
220
+ $defaults[] = 'item-locked';
 
221
  }
 
 
222
  }
223
+ $classes = apply_filters( 'learn-press/course-item-class', $defaults, $this->get_item_type(), $this->get_id(), $course_id );
224
+
225
+ // Filter unwanted values
226
+ $classes = is_array( $classes ) ? $classes : explode( ' ', $classes );
227
+ $classes = array_filter( $classes );
228
+ $classes = array_unique( $classes );
229
 
230
+ wp_cache_set( 'item-' . $user_id . '-' . $this->get_id(), $classes, 'lp-post-classes' );
231
+ }
232
 
233
+ return apply_filters( 'learn-press/course-item-class-cached', $classes, $this->get_item_type(), $this->get_id(), $course_id );
 
 
 
 
234
  }
235
 
236
  /**
250
  /**
251
  * Set course parent of this item.
252
  *
253
+ * @param LP_Course|LP_Abstract_Course|int $course
254
  */
255
  public function set_course( $course ) {
256
  if ( is_numeric( $course ) ) {
286
  /**
287
  * Get instance of an item from post
288
  *
289
+ * @param WP_Post|int $post
290
+ * @param LP_Course|LP_Abstract_Course|int $course
291
  *
292
  * @return LP_Course_Item
293
  */
294
+ public static function get_item( $post, $course = null ) {
 
295
  $item_type = '';
296
  $item_id = 0;
297
 
304
  $item_id = $post->ID;
305
  }
306
 
307
+ if ( false === ( $item = wp_cache_get( $item_id, 'lp-object-classes' ) ) ) {
 
 
308
 
309
+ if ( $item_type ) {
310
+ if ( learn_press_is_support_course_item_type( $item_type ) ) {
311
+ $type = str_replace( 'lp_', '', $item_type );
312
 
313
+ $class = apply_filters( 'learn-press/course-item-object-class', false, $type, $item_type, $item_id );
 
 
 
 
314
 
315
+ if ( is_string( $class ) && class_exists( $class ) ) {
316
+ $item = new $class( $post->ID, $post );
317
+ } elseif ( $class instanceof LP_Course_Item ) {
318
+ $item = $class;
319
+ }
320
 
321
+ if ( ! $item ) {
322
+
323
+ switch ( $type ) {
324
+ case 'lesson':
325
+ $item = LP_Lesson::get_lesson( $item_id );
326
+ break;
327
+ case 'quiz':
328
+ $item = LP_Quiz::get_quiz( $item_id );
329
+ break;
330
+ }
331
  }
332
  }
333
  }
334
+ wp_cache_set( $item_id, $item, 'lp-object-classes' );
335
+
336
+ if ( $course ) {
337
+ $item->set_course( $course );
338
+ }
339
  }
340
 
341
  return apply_filters( 'learn-press/get-course-item', $item, $item_type, $item_id );
466
 
467
  if ( $item_status ) {
468
  $status_classes[] = 'course-item-status';
 
469
  $status_classes[] = 'item-' . $item_status;
470
  }
471
  switch ( $item_status ) {
506
  * @return bool
507
  */
508
  public function is_blocked( $course_id = 0, $user_id = 0 ) {
509
+ if ( ! $user_id ) {
510
+ $user_id = get_current_user_id();
511
+ }
512
 
513
+ if ( ! $course_id ) {
514
+ $course_id = get_the_ID();
 
 
 
515
  }
516
 
517
+ $key = 'course-item-' . $user_id . '-' . $course_id;
518
+
519
+ if ( false === ( $blocked_items = wp_cache_get( $key, 'blocked-items' ) ) ) {
520
+ $blocked_items = $this->_parse_item_block_status( $course_id, $user_id, $key );
521
  }
522
 
523
+ $is_blocked = isset( $blocked_items[ $this->get_id() ] ) ? $blocked_items[ $this->get_id() ] : false;
524
 
525
+ if ( false === $is_blocked ) {
526
+ if ( $course_id ) {
527
+ $course = learn_press_get_course( $course_id );
528
+ } else {
529
+ $course = $this->get_course();
530
+ $course_id = $course ? $course->get_id() : 0;
531
+ }
532
+
533
+ if ( ! $user_id ) {
534
+ $user_id = get_current_user_id();
535
+ }
536
+
537
+ $user = learn_press_get_user( $user_id );
538
+
539
+ if ( ! $course ) {
540
+ $blocked = 'yes';
541
+ } else if ( ! $course->is_required_enroll() || $this->is_preview() ) {
542
+ $blocked = 'no';
543
+ } else {
544
+ if ( $user ) {
545
+ $blocked = $this->_item_is_blocked( $user, $course, $user->get_course_data( $course_id ) );
546
  } else {
547
+ $blocked = 'yes';
548
  }
 
 
549
  }
550
+
551
+ if ( ! is_array( $blocked_items ) ) {
552
+ $blocked_items = array();
553
+ }
554
+ $blocked_items[ $this->get_id() ] = $blocked;
555
+
556
+ wp_cache_set( $key, $blocked_items, 'blocked-items' );
557
+ $is_blocked = $blocked;
558
+ //return apply_filters( 'learn-press/course-item/is-blocked', $blocked === 'yes' ? true : false, $this->get_id(), $course_id, $user_id );
559
+ }
560
+
561
+ return apply_filters( 'learn-press/course-item/is-blocked', $is_blocked === 'yes' ? true : false, $this->get_id(), $course_id, $user_id );
562
+ }
563
+
564
+ protected function _parse_item_block_status( $course_id, $user_id, $cache_key ) {
565
+ if ( ! $course = learn_press_get_course( $course_id ) ) {
566
+ return false;
567
+ }
568
+
569
+ $user = learn_press_get_user( $user_id );
570
+ $course_items = $course->get_items();
571
+ $course_item_data = $user->get_course_data( $course_id );
572
+
573
+ if ( ! $course->is_required_enroll() ) {
574
+ $blocked_items = array_fill_keys( $course_items, 'no' );
575
+ } elseif ( ! $user || $user->is_guest() ) {
576
+ $blocked_items = array_fill_keys( $course_items, 'yes' );
577
+ } else {
578
+ $blocked = $this->_item_is_blocked( $user, $course, $course_item_data );
579
+ $blocked_items = array_fill_keys( $course_items, $blocked );
580
+ }
581
+ $block_item_types = learn_press_get_block_course_item_types();
582
+
583
+ foreach ( $course_items as $course_item ) {
584
+ if ( $item = $course->get_item( $course_item ) ) {
585
+ if ( $item->is_preview() ) {
586
+ $blocked_items[ $course_item ] = 'no';
587
+ } elseif ( ! $block_item_types || is_array( $block_item_types ) && ! in_array( $item->get_post_type(), $block_item_types ) ) {
588
+ $blocked_items[ $course_item ] = 'no';
589
+ }
590
+ }
591
+ }
592
+
593
+ $blocked_items = apply_filters( 'learn-press/course-item/parse-block-statuses', $blocked_items, $course_id, $user_id );
594
+
595
+ wp_cache_set( $cache_key, $blocked_items, 'blocked-items' );
596
+
597
+ return $blocked_items;
598
+ }
599
+
600
+ /**
601
+ * @param LP_User $user
602
+ * @param LP_Course $course
603
+ * @param LP_User_Item_Course $course_item_data
604
+ *
605
+ * @return string
606
+ */
607
+ protected function _item_is_blocked( $user, $course, $course_item_data ) {
608
+ if ( $is_admin = in_array( 'administrator', $user->get_roles() ) ) {
609
+ $blocked = 'no';
610
+ } else if ( $user->has_course_status( $course->get_id(), array( 'enrolled', 'finished' ) ) ) {
611
+ $blocked = 'no';
612
+
613
+ if ( $course->is_block_item_content() && $course_item_data->get_finishing_type() !== 'click'/*$course_item_data->is_exceeded() < 0*/ ) {
614
+ $blocked = 'yes';
615
+ }
616
+ } else {
617
+ $blocked = 'yes';
618
  }
619
 
620
+ return $blocked;
621
  }
622
 
623
  public function offsetExists( $offset ) {
inc/course/lp-course-functions.php CHANGED
@@ -348,7 +348,7 @@ function learn_press_user_can_view_lesson( $lesson_id, $course_id = 0, $user_id
348
  $user = LP_Global::user();
349
  }
350
 
351
- return $user ? $user->can( 'view-lesson', $lesson_id, $course_id ) : false;
352
  }
353
 
354
  /**
@@ -368,7 +368,7 @@ function learn_press_user_can_view_quiz( $quiz_id = null, $course_id = 0, $user_
368
  $user = LP_Global::user();
369
  }
370
 
371
- return $user ? $user->can( 'view-quiz', $quiz_id, $course_id ) : false;
372
  }
373
 
374
  /**
@@ -523,7 +523,16 @@ function learn_press_course_add_support_item_type( $post_type, $label = '' ) {
523
  function learn_press_is_support_course_item_type( $type ) {
524
  $types = learn_press_course_get_support_item_types();
525
 
526
- return $type && ! empty( $types[ $type ] );
 
 
 
 
 
 
 
 
 
527
  }
528
 
529
  learn_press_course_add_support_item_type(
@@ -1031,6 +1040,10 @@ function learn_press_enroll_course_from_url() {
1031
  return;
1032
  }
1033
 
 
 
 
 
1034
  if ( $user->has_enrolled_course( $course_id ) ) {
1035
 
1036
  // If user is just logged in
348
  $user = LP_Global::user();
349
  }
350
 
351
+ return $user ? $user->can_view_lesson( $lesson_id, $course_id ) : false;
352
  }
353
 
354
  /**
368
  $user = LP_Global::user();
369
  }
370
 
371
+ return $user ? $user->can_view_quiz( $quiz_id, $course_id ) : false;
372
  }
373
 
374
  /**
523
  function learn_press_is_support_course_item_type( $type ) {
524
  $types = learn_press_course_get_support_item_types();
525
 
526
+ if ( is_array( $type ) ) {
527
+ $support = true;
528
+ foreach ( $type as $t ) {
529
+ $support = $support && learn_press_is_support_course_item_type( $t );
530
+ }
531
+ } else {
532
+ $support = $type && ! empty( $types[ $type ] );
533
+ }
534
+
535
+ return $support;
536
  }
537
 
538
  learn_press_course_add_support_item_type(
1040
  return;
1041
  }
1042
 
1043
+ if ( ! $user->can_enroll_course( $course_id ) ) {
1044
+ return;
1045
+ }
1046
+
1047
  if ( $user->has_enrolled_course( $course_id ) ) {
1048
 
1049
  // If user is just logged in
inc/curds/class-lp-order-curd.php CHANGED
@@ -319,7 +319,7 @@ class LP_Order_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
319
  */
320
  public function cln( $order ) {
321
 
322
- $cloned = function_exists( 'clone' ) ? clone ( $order ) : clone $order;
323
 
324
  $cloned->set_id( 0 );
325
  $cloned->save();
@@ -444,126 +444,127 @@ class LP_Order_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
444
  $users = 0;
445
  }
446
 
447
- $order->set_data_via_methods(
448
- array(
449
- 'user_id' => $users,//get_post_meta( $order->get_id(), '_user_id', true ),
450
- 'order_date' => new LP_Datetime( $post->post_date ),
451
- 'date_modified' => new LP_Datetime( $post->post_modified ),
452
- 'status' => str_replace( 'lp-', '', $post->post_status ),
453
- 'parent_id' => $post->post_parent,
454
- 'created_via' => get_post_meta( $post->ID, '_created_via', true ),
455
- 'total' => get_post_meta( $post->ID, '_order_total', true ),
456
- 'subtotal' => get_post_meta( $post->ID, '_order_subtotal', true ),
457
- 'order_key' => get_post_meta( $post->ID, '_order_key', true ),
458
- 'user_ip_address' => get_post_meta( $post->ID, '_user_ip_address', true ),
459
- 'user_agent' => get_post_meta( $post->ID, '_user_agent', true ),
460
- 'checkout_email' => get_post_meta( $post->ID, '_checkout_email', true ),
461
- 'currency' => get_post_meta( $post->ID, '_order_currency', true )
462
- )
463
- );
464
- $this->read_items( $order );
465
- $order->read_meta();
 
 
 
466
  }
467
 
468
- return true;
469
- }
 
 
 
 
 
 
 
 
 
470
 
471
- /**
472
- * Recover an order checked out by Guest for an user.
473
- *
474
- * @param string $order_key
475
- * @param int $user_id
476
- *
477
- * @return bool|LP_Order|WP_Error
478
- */
479
- public function recover( $order_key, $user_id ) {
480
- try {
481
- $order = $this->get_order_by_key( $order_key );
482
 
483
- // Validations
484
- if ( ! $order ) {
485
- throw new Exception( __( 'Invalid order.', 'learnpress' ), 1000 );
486
- }
487
 
488
- if ( ! $order->is_guest() ) {
489
- throw new Exception( __( 'Order is already assigned.', 'learnpress' ), 1010 );
490
- }
491
 
492
- $user = learn_press_get_user( $user_id );
 
 
493
 
494
- if ( ! $user ) {
495
- throw new Exception( __( 'User does not exist.', 'learnpress' ), 1020 );
496
- }
497
 
498
- global $wpdb;
 
 
499
 
500
- // Set user to order and update
501
- $order->set_user_id( $user_id );
502
- $order->save();
 
 
 
503
 
504
- // Trigger action
505
- do_action( 'learn-press/order/recovered-successful', $order->get_id(), $user_id );
506
- } catch ( Exception $ex ) {
507
- return new WP_Error( $ex->getCode(), $ex->getMessage() );
508
  }
509
 
510
- return $order;
511
- }
512
-
513
- /**
514
- * Retrieve an order by order key.
515
- *
516
- * @param string $order_key
517
- *
518
- * @return bool|LP_Order
519
- */
520
- public function get_order_by_key( $order_key ) {
521
- global $wpdb;
522
- $query = $wpdb->prepare( "
523
  SELECT ID
524
  FROM {$wpdb->posts} p
525
  INNER JOIN {$wpdb->postmeta} pm ON pm.post_id = p.ID AND pm.meta_key = %s AND pm.meta_value = %s
526
  ", '_order_key', $order_key );
527
 
528
- $order = false;
529
- if ( $order_id = $wpdb->get_var( $query ) ) {
530
- $order = learn_press_get_order( $order_id );
531
- }
532
 
533
- return $order;
534
- }
535
 
536
- /**
537
- * Get all child orders of an order by id
538
- *
539
- * @param int $order_id
540
- *
541
- * @return array|bool|mixed
542
- */
543
- public function get_child_orders( $order_id ) {
544
- global $wpdb;
545
 
546
- if ( false === ( $orders = wp_cache_get( 'order-' . $order_id, 'lp-child-orders' ) ) ) {
547
- $query = $wpdb->prepare( "
548
  SELECT *
549
  FROM {$wpdb->posts}
550
  WHERE post_parent = %d
551
  ", $order_id );
552
- if ( $posts = $wpdb->get_results( $query ) ) {
553
- foreach ( $posts as $order ) {
554
- new WP_Post( $order );
555
- $orders[] = $order->ID;
 
 
 
556
  }
557
- } else {
558
- $orders = array();
559
  }
560
- wp_cache_set( 'order-' . $order_id, $orders, 'lp-child-orders' );
561
- }
562
 
563
- return $orders;
564
- }
565
 
566
- public function duplicate( &$order, $args = array() ) {
567
- // TODO: Implement duplicate() method.
568
- }
569
  }
319
  */
320
  public function cln( $order ) {
321
 
322
+ $cloned = clone $order;
323
 
324
  $cloned->set_id( 0 );
325
  $cloned->save();
444
  $users = 0;
445
  }
446
 
447
+ $order->set_data_via_methods(
448
+ array(
449
+ 'user_id' => $users,//get_post_meta( $order->get_id(), '_user_id', true ),
450
+ 'order_date' => new LP_Datetime( $post->post_date ),
451
+ 'date_modified' => new LP_Datetime( $post->post_modified ),
452
+ 'status' => str_replace( 'lp-', '', $post->post_status ),
453
+ 'parent_id' => $post->post_parent,
454
+ 'created_via' => get_post_meta( $post->ID, '_created_via', true ),
455
+ 'total' => get_post_meta( $post->ID, '_order_total', true ),
456
+ 'subtotal' => get_post_meta( $post->ID, '_order_subtotal', true ),
457
+ 'order_key' => get_post_meta( $post->ID, '_order_key', true ),
458
+ 'user_ip_address' => get_post_meta( $post->ID, '_user_ip_address', true ),
459
+ 'user_agent' => get_post_meta( $post->ID, '_user_agent', true ),
460
+ 'checkout_email' => get_post_meta( $post->ID, '_checkout_email', true ),
461
+ 'currency' => get_post_meta( $post->ID, '_order_currency', true )
462
+ )
463
+ );
464
+ $this->read_items( $order );
465
+ $order->read_meta();
466
+ }
467
+
468
+ return true;
469
  }
470
 
471
+ /**
472
+ * Recover an order checked out by Guest for an user.
473
+ *
474
+ * @param string $order_key
475
+ * @param int $user_id
476
+ *
477
+ * @return bool|LP_Order|WP_Error
478
+ */
479
+ public function recover( $order_key, $user_id ) {
480
+ try {
481
+ $order = $this->get_order_by_key( $order_key );
482
 
483
+ // Validations
484
+ if ( ! $order ) {
485
+ throw new Exception( __( 'Invalid order.', 'learnpress' ), 1000 );
486
+ }
 
 
 
 
 
 
 
487
 
488
+ if ( ! $order->is_guest() ) {
489
+ throw new Exception( __( 'Order is already assigned.', 'learnpress' ), 1010 );
490
+ }
 
491
 
492
+ $user = learn_press_get_user( $user_id );
 
 
493
 
494
+ if ( ! $user ) {
495
+ throw new Exception( __( 'User does not exist.', 'learnpress' ), 1020 );
496
+ }
497
 
498
+ global $wpdb;
 
 
499
 
500
+ // Set user to order and update
501
+ $order->set_user_id( $user_id );
502
+ $order->save();
503
 
504
+ // Trigger action
505
+ do_action( 'learn-press/order/recovered-successful', $order->get_id(), $user_id );
506
+ }
507
+ catch ( Exception $ex ) {
508
+ return new WP_Error( $ex->getCode(), $ex->getMessage() );
509
+ }
510
 
511
+ return $order;
 
 
 
512
  }
513
 
514
+ /**
515
+ * Retrieve an order by order key.
516
+ *
517
+ * @param string $order_key
518
+ *
519
+ * @return bool|LP_Order
520
+ */
521
+ public function get_order_by_key( $order_key ) {
522
+ global $wpdb;
523
+ $query = $wpdb->prepare( "
 
 
 
524
  SELECT ID
525
  FROM {$wpdb->posts} p
526
  INNER JOIN {$wpdb->postmeta} pm ON pm.post_id = p.ID AND pm.meta_key = %s AND pm.meta_value = %s
527
  ", '_order_key', $order_key );
528
 
529
+ $order = false;
530
+ if ( $order_id = $wpdb->get_var( $query ) ) {
531
+ $order = learn_press_get_order( $order_id );
532
+ }
533
 
534
+ return $order;
535
+ }
536
 
537
+ /**
538
+ * Get all child orders of an order by id
539
+ *
540
+ * @param int $order_id
541
+ *
542
+ * @return array|bool|mixed
543
+ */
544
+ public function get_child_orders( $order_id ) {
545
+ global $wpdb;
546
 
547
+ if ( false === ( $orders = wp_cache_get( 'order-' . $order_id, 'lp-child-orders' ) ) ) {
548
+ $query = $wpdb->prepare( "
549
  SELECT *
550
  FROM {$wpdb->posts}
551
  WHERE post_parent = %d
552
  ", $order_id );
553
+ if ( $posts = $wpdb->get_results( $query ) ) {
554
+ foreach ( $posts as $order ) {
555
+ new WP_Post( $order );
556
+ $orders[] = $order->ID;
557
+ }
558
+ } else {
559
+ $orders = array();
560
  }
561
+ wp_cache_set( 'order-' . $order_id, $orders, 'lp-child-orders' );
 
562
  }
 
 
563
 
564
+ return $orders;
565
+ }
566
 
567
+ public function duplicate( &$order, $args = array() ) {
568
+ // TODO: Implement duplicate() method.
569
+ }
570
  }
inc/curds/class-lp-question-curd.php CHANGED
@@ -919,7 +919,7 @@ if ( ! class_exists( 'LP_Question_CURD' ) ) {
919
  SELECT *
920
  FROM {$wpdb->prefix}learnpress_question_answers
921
  WHERE question_id IN(" . join( ',', $format ) . ")
922
- ORDER BY question_id, answer_order ASC
923
  ", $question_ids );
924
 
925
  $question_answers = array();
919
  SELECT *
920
  FROM {$wpdb->prefix}learnpress_question_answers
921
  WHERE question_id IN(" . join( ',', $format ) . ")
922
+ ORDER BY question_id, answer_order, question_answer_id ASC
923
  ", $question_ids );
924
 
925
  $question_answers = array();
inc/curds/class-lp-quiz-curd.php CHANGED
@@ -222,7 +222,7 @@ if ( ! function_exists( 'LP_Quiz_CURD' ) ) {
222
  INNER JOIN {$wpdb->prefix}learnpress_quiz_questions qq ON p.ID = qq.question_id
223
  WHERE qq.quiz_id IN(" . join( ',', $format ) . ")
224
  AND p.post_status = %s
225
- ORDER BY question_order ASC
226
  ", $args );
227
 
228
  $question_ids = array();
@@ -273,10 +273,10 @@ if ( ! function_exists( 'LP_Quiz_CURD' ) ) {
273
  global $wpdb;
274
  $format = array_fill( 0, sizeof( $meta_ids ), '%d' );
275
  $query = $wpdb->prepare( "
276
- SELECT *
277
- FROM {$wpdb->learnpress_question_answermeta}
278
- WHERE learnpress_question_answer_id IN(" . join( ',', $format ) . ")
279
- ", $meta_ids );
280
  if ( $metas = $wpdb->get_results( $query ) ) {
281
  foreach ( $metas as $meta ) {
282
  $key = $meta->meta_key;
222
  INNER JOIN {$wpdb->prefix}learnpress_quiz_questions qq ON p.ID = qq.question_id
223
  WHERE qq.quiz_id IN(" . join( ',', $format ) . ")
224
  AND p.post_status = %s
225
+ ORDER BY question_order, quiz_question_id ASC
226
  ", $args );
227
 
228
  $question_ids = array();
273
  global $wpdb;
274
  $format = array_fill( 0, sizeof( $meta_ids ), '%d' );
275
  $query = $wpdb->prepare( "
276
+ SELECT *
277
+ FROM {$wpdb->learnpress_question_answermeta}
278
+ WHERE learnpress_question_answer_id IN(" . join( ',', $format ) . ")
279
+ ", $meta_ids );
280
  if ( $metas = $wpdb->get_results( $query ) ) {
281
  foreach ( $metas as $meta ) {
282
  $key = $meta->meta_key;
inc/curds/class-lp-user-curd.php CHANGED
@@ -128,7 +128,7 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
128
  public function get_orders( $user_id, $args = array() ) {
129
 
130
  // If user does not exists
131
- if ( ! $user = learn_press_get_user( $user_id ) ) {
132
  return false;
133
  }
134
 
@@ -230,10 +230,12 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
230
  if ( $orders ) {
231
  if ( array_key_exists( 'status', $args ) && $args['status'] ) {
232
  LP_Helper::sanitize_order_status( $args['status'] );
 
 
233
  foreach ( $orders as $course_id => $order_ids ) {
234
  $orders[ $course_id ] = array();
235
  foreach ( $order_ids as $order_id ) {
236
- if ( in_array( get_post_status( $order_id ), $args['status'] ) ) {
237
  $orders[ $course_id ][] = $order_id;
238
  }
239
  }
@@ -926,6 +928,7 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
926
 
927
  $query = $wpdb->prepare( "SELECT user_item_id FROM {$wpdb->learnpress_user_items} WHERE " . join( ' AND ', $query_where ), array_values( $where ) );
928
  $user_item_ids = $wpdb->get_col( $query );
 
929
  $wpdb->delete(
930
  $wpdb->learnpress_user_items,
931
  $where,
@@ -936,6 +939,10 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
936
  $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->learnpress_user_itemmeta} WHERE learnpress_user_item_id = %d", $user_item_id ) );
937
  do_action( 'learn-press/deleted-user-item', $user_item_id );
938
  }
 
 
 
 
939
 
940
  return true;
941
  }
@@ -1152,10 +1159,12 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
1152
  $from = "FROM {$wpdb->learnpress_user_items} ui";
1153
  $join = $wpdb->prepare( "INNER JOIN {$wpdb->posts} c ON c.ID = ui.item_id AND c.post_type = %s", LP_COURSE_CPT );
1154
  //$where = $wpdb->prepare( "WHERE 1 AND user_id = %d AND ref_id IN(" . join( ',', $order_format ) . ")", array_merge( array( $user_id ), $valid_orders ) );
1155
- $where = $wpdb->prepare( "WHERE 1 AND user_id = %d", $user_id );
1156
  $having = "HAVING 1";
1157
  $orderby = "ORDER BY item_id, user_item_id DESC";
1158
 
 
 
1159
  if ( ! empty( $args['status'] ) ) {
1160
  switch ( $args['status'] ) {
1161
  case 'finished':
@@ -1189,6 +1198,10 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
1189
  }
1190
  }
1191
 
 
 
 
 
1192
  $where .= $wpdb->prepare( " AND ui.status NOT IN(%s)", 'pending' );
1193
 
1194
  $query_parts = apply_filters(
@@ -1199,6 +1212,30 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
1199
  );
1200
  list( $select, $from, $join, $where, $having, $orderby ) = array_values( $query_parts );
1201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1202
  $sql = "
1203
  SELECT SQL_CALC_FOUND_ROWS *
1204
  FROM
@@ -1215,6 +1252,10 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
1215
 
1216
  $items = $wpdb->get_results( $sql, ARRAY_A );
1217
 
 
 
 
 
1218
  if ( $items ) {
1219
  $count = $wpdb->get_var( "SELECT FOUND_ROWS()" );
1220
  $course_ids = wp_list_pluck( $items, 'item_id' );
@@ -1223,7 +1264,8 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
1223
  $courses['total'] = $count;
1224
  $courses['pages'] = ceil( $count / $args['limit'] );
1225
  foreach ( $items as $item ) {
1226
- $courses['items'][] = new LP_User_Item_Course( $item );
 
1227
  }
1228
  }
1229
  }
@@ -1237,9 +1279,66 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
1237
  $courses['single'] = __( 'course', 'learnpress' );
1238
  $courses['plural'] = __( 'courses', 'learnpress' );
1239
 
 
1240
  return new LP_Query_List_Table( $courses );
1241
  }
1242
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1243
  /**
1244
  * Query quizzes by user.
1245
  *
@@ -1350,9 +1449,9 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
1350
  {$from}
1351
  {$join}
1352
  {$where}
1353
- {$having}
1354
  {$orderby}
1355
  ) X GROUP BY item_id
 
1356
  LIMIT {$offset}, {$limit}
1357
  ";
1358
 
128
  public function get_orders( $user_id, $args = array() ) {
129
 
130
  // If user does not exists
131
+ if ( ! $user_id || ! $user = learn_press_get_user( $user_id ) ) {
132
  return false;
133
  }
134
 
230
  if ( $orders ) {
231
  if ( array_key_exists( 'status', $args ) && $args['status'] ) {
232
  LP_Helper::sanitize_order_status( $args['status'] );
233
+
234
+ $statuses = (array) $args['status'];
235
  foreach ( $orders as $course_id => $order_ids ) {
236
  $orders[ $course_id ] = array();
237
  foreach ( $order_ids as $order_id ) {
238
+ if ( in_array( get_post_status( $order_id ), $statuses ) ) {
239
  $orders[ $course_id ][] = $order_id;
240
  }
241
  }
928
 
929
  $query = $wpdb->prepare( "SELECT user_item_id FROM {$wpdb->learnpress_user_items} WHERE " . join( ' AND ', $query_where ), array_values( $where ) );
930
  $user_item_ids = $wpdb->get_col( $query );
931
+
932
  $wpdb->delete(
933
  $wpdb->learnpress_user_items,
934
  $where,
939
  $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->learnpress_user_itemmeta} WHERE learnpress_user_item_id = %d", $user_item_id ) );
940
  do_action( 'learn-press/deleted-user-item', $user_item_id );
941
  }
942
+ // if($user_item_ids) {
943
+ // // Flush all cache to apply new changes
944
+ // wp_cache_flush();
945
+ // }
946
 
947
  return true;
948
  }
1159
  $from = "FROM {$wpdb->learnpress_user_items} ui";
1160
  $join = $wpdb->prepare( "INNER JOIN {$wpdb->posts} c ON c.ID = ui.item_id AND c.post_type = %s", LP_COURSE_CPT );
1161
  //$where = $wpdb->prepare( "WHERE 1 AND user_id = %d AND ref_id IN(" . join( ',', $order_format ) . ")", array_merge( array( $user_id ), $valid_orders ) );
1162
+ $where = $wpdb->prepare( "WHERE 1 AND user_id = %d AND c.post_status = %s", $user_id, 'publish' );
1163
  $having = "HAVING 1";
1164
  $orderby = "ORDER BY item_id, user_item_id DESC";
1165
 
1166
+ $unenrolled_course_ids = array();
1167
+
1168
  if ( ! empty( $args['status'] ) ) {
1169
  switch ( $args['status'] ) {
1170
  case 'finished':
1198
  }
1199
  }
1200
 
1201
+ if ( empty( $args['status'] ) || $args['status'] === 'not-enrolled' ) {
1202
+ $unenrolled_course_ids = $this->query_courses_by_order( $user_id );
1203
+ }
1204
+
1205
  $where .= $wpdb->prepare( " AND ui.status NOT IN(%s)", 'pending' );
1206
 
1207
  $query_parts = apply_filters(
1212
  );
1213
  list( $select, $from, $join, $where, $having, $orderby ) = array_values( $query_parts );
1214
 
1215
+ /**
1216
+ * If there are some courses user has purchased and it's order is already completed
1217
+ * but for some reasons it is not inserted into table user-items.
1218
+ *
1219
+ * In this case we temporary to add it to table user-items (by using a transaction)
1220
+ * and query it back and then restore data by rollback that transaction.
1221
+ */
1222
+ if ( $unenrolled_course_ids ) {
1223
+ LP_Debug::startTransaction();
1224
+
1225
+ foreach ( $unenrolled_course_ids as $unenrolled_course_id ) {
1226
+ $wpdb->insert(
1227
+ $wpdb->learnpress_user_items,
1228
+ array(
1229
+ 'user_id' => $user_id,
1230
+ 'item_id' => $unenrolled_course_id,
1231
+ 'item_type' => LP_COURSE_CPT,
1232
+ 'status' => 'purchased'
1233
+ ),
1234
+ array( '%d', '%d', '%s', '%s' )
1235
+ );
1236
+ }
1237
+ }
1238
+
1239
  $sql = "
1240
  SELECT SQL_CALC_FOUND_ROWS *
1241
  FROM
1252
 
1253
  $items = $wpdb->get_results( $sql, ARRAY_A );
1254
 
1255
+ if ( $unenrolled_course_ids ) {
1256
+ LP_Debug::rollbackTransaction();
1257
+ }
1258
+
1259
  if ( $items ) {
1260
  $count = $wpdb->get_var( "SELECT FOUND_ROWS()" );
1261
  $course_ids = wp_list_pluck( $items, 'item_id' );
1264
  $courses['total'] = $count;
1265
  $courses['pages'] = ceil( $count / $args['limit'] );
1266
  foreach ( $items as $item ) {
1267
+ $course_item = new LP_User_Item_Course( $item );
1268
+ $courses['items'][] = $course_item;
1269
  }
1270
  }
1271
  }
1279
  $courses['single'] = __( 'course', 'learnpress' );
1280
  $courses['plural'] = __( 'courses', 'learnpress' );
1281
 
1282
+
1283
  return new LP_Query_List_Table( $courses );
1284
  }
1285
 
1286
+ /**
1287
+ * Get courses user has purchased via orders are completed
1288
+ * but it is not already added to user-items table.
1289
+ *
1290
+ * @param int $user_id
1291
+ *
1292
+ * @return array|bool|mixed
1293
+ */
1294
+ public function query_courses_by_order( $user_id ) {
1295
+ global $wpdb;
1296
+
1297
+ // $query = $wpdb->prepare( "
1298
+ // SELECT course.ID AS course_id, `order`.ID AS order_id, `order`.post_parent AS order_parent
1299
+ // FROM {$wpdb->posts} `order`
1300
+ // INNER JOIN {$wpdb->learnpress_order_items} oi ON oi.order_id = `order`.ID
1301
+ // INNER JOIN {$wpdb->learnpress_order_itemmeta} oim ON oi.order_item_id = oim.learnpress_order_item_id AND oim.meta_key = %s
1302
+ // INNER JOIN {$wpdb->posts} course ON course.ID = oim.meta_value
1303
+ // INNER JOIN {$wpdb->postmeta} pmu ON pmu.post_id = `order`.ID AND pmu.meta_key = %s
1304
+ // WHERE pmu.meta_value = %d
1305
+ // ORDER BY order_id DESC
1306
+ // ", '_course_id', '_user_id', $user_id );
1307
+ // $course_ids = $wpdb->get_col( $query );
1308
+
1309
+ $query = $wpdb->prepare( "
1310
+ SELECT item_id
1311
+ FROM {$wpdb->learnpress_user_items}
1312
+ WHERE user_id = %d
1313
+ AND item_type = %s
1314
+ ", $user_id, LP_COURSE_CPT );
1315
+ $user_item_ids = $wpdb->get_col( $query );
1316
+
1317
+ $orders = $this->get_orders( $user_id, array(
1318
+ 'status' => 'completed',
1319
+ 'group_by_order' => true
1320
+ ) );
1321
+
1322
+ if ( ! $orders ) {
1323
+ return false;
1324
+ }
1325
+
1326
+ $course_ids = array_shift( $orders );
1327
+
1328
+ foreach ( $orders as $ids ) {
1329
+ if ( ! $ids ) {
1330
+ continue;
1331
+ }
1332
+ $course_ids = array_merge( $course_ids, $ids );
1333
+ }
1334
+
1335
+ if ( $user_item_ids ) {
1336
+ $course_ids = array_diff( $course_ids, $user_item_ids );
1337
+ }
1338
+
1339
+ return $course_ids;
1340
+ }
1341
+
1342
  /**
1343
  * Query quizzes by user.
1344
  *
1449
  {$from}
1450
  {$join}
1451
  {$where}
 
1452
  {$orderby}
1453
  ) X GROUP BY item_id
1454
+ {$having}
1455
  LIMIT {$offset}, {$limit}
1456
  ";
1457
 
inc/curds/class-lp-user-item-curd.php CHANGED
@@ -85,8 +85,9 @@ class LP_User_Item_CURD implements LP_Interface_CURD {
85
  FROM {$wpdb->posts} p
86
  INNER JOIN {$wpdb->prefix}learnpress_quiz_questions qq ON p.ID = qq.question_id
87
  WHERE qq.quiz_id = %d
 
88
  ORDER BY question_order ASC
89
- ", $id );
90
  if ( $results = $wpdb->get_results( $query, OBJECT_K ) ) {
91
  foreach ( $results as $k => $v ) {
92
  wp_cache_set( $v->ID, $v, 'posts' );
85
  FROM {$wpdb->posts} p
86
  INNER JOIN {$wpdb->prefix}learnpress_quiz_questions qq ON p.ID = qq.question_id
87
  WHERE qq.quiz_id = %d
88
+ AND p.post_status = %s
89
  ORDER BY question_order ASC
90
+ ", $id, 'publish' );
91
  if ( $results = $wpdb->get_results( $query, OBJECT_K ) ) {
92
  foreach ( $results as $k => $v ) {
93
  wp_cache_set( $v->ID, $v, 'posts' );
inc/custom-post-types/abstract.php CHANGED
@@ -73,6 +73,7 @@ abstract class LP_Abstract_Post_Type {
73
  add_action( 'init', array( $this, '_do_register' ) );
74
  add_action( 'save_post', array( $this, '_do_save' ), 10, 2 );
75
  add_action( 'before_delete_post', array( $this, '_before_delete_post' ) );
 
76
 
77
  add_filter( 'manage_edit-' . $this->_post_type . '_sortable_columns', array( $this, 'sortable_columns' ) );
78
  add_filter( 'manage_' . $this->_post_type . '_posts_columns', array( $this, 'columns_head' ) );
@@ -150,7 +151,7 @@ abstract class LP_Abstract_Post_Type {
150
  jQuery(function ($) {
151
  var $input = $('#post-search-input'),
152
  $form = $($input[0].form),
153
- $select = $('<select name="author" id="author"></select>').append('<?php echo $option;?>').insertAfter($input).select2({
154
  ajax: {
155
  url: window.location.href + '&lp-ajax=search-authors',
156
  dataType: 'json',
@@ -175,7 +176,7 @@ abstract class LP_Abstract_Post_Type {
175
  ?>
176
  <script>
177
  jQuery(function ($) {
178
- var isAssigned = '<?php echo $this->is_assigned();?>',
179
  $postStatus = $('#post_status'),
180
  $message = $('<p class="learn-press-notice-assigned-item"></p>').html(isAssigned),
181
  currentStatus = $postStatus.val();
@@ -207,7 +208,7 @@ abstract class LP_Abstract_Post_Type {
207
  ", get_the_ID() );
208
 
209
  if ( $course_id = $wpdb->get_var( $query ) ) {
210
- return __( 'This item has already assigned to course. It will be removed from course if it is not publish.', 'learnpress' );
211
  }
212
  } elseif ( LP_QUESTION_CPT === $post_type ) {
213
  $query = $wpdb->prepare( "
@@ -218,7 +219,7 @@ abstract class LP_Abstract_Post_Type {
218
  ", get_the_ID() );
219
 
220
  if ( $quiz_id = $wpdb->get_var( $query ) ) {
221
- return __( 'This question has already assigned to quiz. It will be removed from quiz if it is not publish.', 'learnpress' );
222
  }
223
  }
224
 
@@ -304,10 +305,6 @@ abstract class LP_Abstract_Post_Type {
304
  * @return bool
305
  */
306
  public function _do_save( $post_id, $post = null ) {
307
-
308
- // Flush the Hard Cache to applies new changes
309
- LP_Hard_Cache::flush();
310
-
311
  // Maybe remove
312
  $this->maybe_remove_assigned( $post_id );
313
 
@@ -316,21 +313,71 @@ abstract class LP_Abstract_Post_Type {
316
  }
317
  // TODO: check more here
318
  // prevent loop action
319
- remove_action( 'save_post', array( $this, '_do_save' ), 10, 2 );
320
  $func_args = func_get_args();
321
  $this->_call_method( 'save', $func_args );
 
322
  add_action( 'save_post', array( $this, '_do_save' ), 10, 2 );
323
 
324
  return $post_id;
325
  }
326
 
327
  public function maybe_remove_assigned( $post_id ) {
328
- $post = get_post( $post_id );
329
- if ( 'publish' === $post->post_status ) {
330
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  }
332
  }
333
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  /**
335
  * Ouput meta boxes.
336
  *
@@ -356,6 +403,15 @@ abstract class LP_Abstract_Post_Type {
356
  }
357
  }
358
 
 
 
 
 
 
 
 
 
 
359
  public function _before_delete_post( $post_id ) {
360
  // TODO:
361
  if ( ! $this->_check_post() ) {
@@ -366,6 +422,16 @@ abstract class LP_Abstract_Post_Type {
366
  return $this->_call_method( 'before_delete', $func_args );
367
  }
368
 
 
 
 
 
 
 
 
 
 
 
369
  public function _posts_fields( $fields ) {
370
  if ( ! $this->_check_post() ) {
371
  return $fields;
73
  add_action( 'init', array( $this, '_do_register' ) );
74
  add_action( 'save_post', array( $this, '_do_save' ), 10, 2 );
75
  add_action( 'before_delete_post', array( $this, '_before_delete_post' ) );
76
+ add_action( 'deleted_post', array( $this, '_deleted_post' ) );
77
 
78
  add_filter( 'manage_edit-' . $this->_post_type . '_sortable_columns', array( $this, 'sortable_columns' ) );
79
  add_filter( 'manage_' . $this->_post_type . '_posts_columns', array( $this, 'columns_head' ) );
151
  jQuery(function ($) {
152
  var $input = $('#post-search-input'),
153
  $form = $($input[0].form),
154
+ $select = $('<select name="author" id="author"></select>').append('<?php echo esc_js($option);?>').insertAfter($input).select2({
155
  ajax: {
156
  url: window.location.href + '&lp-ajax=search-authors',
157
  dataType: 'json',
176
  ?>
177
  <script>
178
  jQuery(function ($) {
179
+ var isAssigned = '<?php echo esc_js( $this->is_assigned() );?>',
180
  $postStatus = $('#post_status'),
181
  $message = $('<p class="learn-press-notice-assigned-item"></p>').html(isAssigned),
182
  currentStatus = $postStatus.val();
208
  ", get_the_ID() );
209
 
210
  if ( $course_id = $wpdb->get_var( $query ) ) {
211
+ return __( 'This item has already assigned to course. It will be removed from course if it is not published.', 'learnpress' );
212
  }
213
  } elseif ( LP_QUESTION_CPT === $post_type ) {
214
  $query = $wpdb->prepare( "
219
  ", get_the_ID() );
220
 
221
  if ( $quiz_id = $wpdb->get_var( $query ) ) {
222
+ return __( 'This question has already assigned to quiz. It will be removed from quiz if it is not published.', 'learnpress' );
223
  }
224
  }
225
 
305
  * @return bool
306
  */
307
  public function _do_save( $post_id, $post = null ) {
 
 
 
 
308
  // Maybe remove
309
  $this->maybe_remove_assigned( $post_id );
310
 
313
  }
314
  // TODO: check more here
315
  // prevent loop action
316
+ remove_action( 'save_post', array( $this, '_do_save' ), 10 );
317
  $func_args = func_get_args();
318
  $this->_call_method( 'save', $func_args );
319
+ $this->_flush_cache();
320
  add_action( 'save_post', array( $this, '_do_save' ), 10, 2 );
321
 
322
  return $post_id;
323
  }
324
 
325
  public function maybe_remove_assigned( $post_id ) {
326
+ global $wpdb;
327
+
328
+ $post = get_post( $post_id );
329
+ $post_type = $this->get_post_type();
330
+ $post_status = $post->post_status;
331
+
332
+ // If we are updating question
333
+ if ( LP_QUESTION_CPT === $post_type ) {
334
+
335
+ // If question is not published then delete it from quizzes
336
+ if ( $post_status !== 'publish' ) {
337
+ $query = $wpdb->prepare( "
338
+ DELETE FROM {$wpdb->learnpress_quiz_questions}
339
+ WHERE question_id = %d
340
+ ", $post_id );
341
+ $wpdb->query( $query );
342
+ }
343
+
344
+ } // Else
345
+ elseif ( learn_press_is_support_course_item_type( $post_type ) ) {
346
+
347
+ // If item is not published then delete it from courses
348
+ if ( $post_status !== 'publish' ) {
349
+ $query = $wpdb->prepare( "
350
+ DELETE FROM {$wpdb->learnpress_section_items}
351
+ WHERE item_id = %d
352
+ ", $post_id );
353
+ $wpdb->query( $query );
354
+ }
355
  }
356
  }
357
 
358
+ protected function _get_quizzes_by_question( $question_id ) {
359
+ global $wpdb;
360
+ $query = $wpdb->prepare( "
361
+ SELECT quiz_id
362
+ FROM {$wpdb->learnpress_quiz_questions}
363
+ WHERE question_id = %d
364
+ ", $question_id );
365
+
366
+ return $wpdb->get_col( $query );
367
+ }
368
+
369
+ protected function _get_courses_by_item( $item_id ) {
370
+ global $wpdb;
371
+ $query = $wpdb->prepare( "
372
+ SELECT section_course_id
373
+ FROM {$wpdb->learnpress_sections} s
374
+ INNER JOIN {$wpdb->learnpress_section_items} si ON s.section_id = si.section_id
375
+ WHERE si.item_id = %d
376
+ ", $item_id );
377
+
378
+ return $wpdb->get_col( $query );
379
+ }
380
+
381
  /**
382
  * Ouput meta boxes.
383
  *
403
  }
404
  }
405
 
406
+ private function _is_archive() {
407
+ global $pagenow, $post_type;
408
+ if ( ! is_admin() || ( $pagenow != 'edit.php' ) || ( $this->_post_type != LP_Request::get_string( 'post_type' ) ) ) {
409
+ return false;
410
+ }
411
+
412
+ return true;
413
+ }
414
+
415
  public function _before_delete_post( $post_id ) {
416
  // TODO:
417
  if ( ! $this->_check_post() ) {
422
  return $this->_call_method( 'before_delete', $func_args );
423
  }
424
 
425
+ public function _deleted_post( $post_id ) {
426
+ $this->_flush_cache();
427
+ }
428
+
429
+ protected function _flush_cache() {
430
+ // Flush the Hard Cache to applies new changes
431
+ LP_Hard_Cache::flush();
432
+ wp_cache_flush();
433
+ }
434
+
435
  public function _posts_fields( $fields ) {
436
  if ( ! $this->_check_post() ) {
437
  return $fields;
inc/custom-post-types/course.php CHANGED
@@ -616,14 +616,14 @@ if ( ! class_exists( 'LP_Course_Post_Type' ) ) {
616
  'std' => 'no',
617
  ),
618
  array(
619
- 'name' => __( 'Block Lessons Content', 'learnpress' ),
620
  'id' => '_lp_block_lesson_content',
621
  'type' => 'yes_no',
622
  'desc' => __( 'Block lessons content when completed course.', 'learnpress' ),
623
  'std' => 'no',
624
  ),
625
  array(
626
- 'name' => __( 'External Link to buy Course', 'learnpress' ),
627
  'id' => '_lp_external_link_buy_course',
628
  'type' => 'url',
629
  'desc' => __( 'Redirect to this url when you press button buy this course.', 'learnpress' ),
@@ -756,7 +756,7 @@ if ( ! class_exists( 'LP_Course_Post_Type' ) ) {
756
 
757
  $meta_box = array(
758
  'id' => 'course_payment',
759
- 'title' => __( 'Payment', 'learnpress' ),
760
  'priority' => 'high',
761
  'pages' => array( LP_COURSE_CPT ),
762
  'icon' => 'dashicons-clipboard',
616
  'std' => 'no',
617
  ),
618
  array(
619
+ 'name' => __( 'Block Lessons', 'learnpress' ),
620
  'id' => '_lp_block_lesson_content',
621
  'type' => 'yes_no',
622
  'desc' => __( 'Block lessons content when completed course.', 'learnpress' ),
623
  'std' => 'no',
624
  ),
625
  array(
626
+ 'name' => __( 'External Link', 'learnpress' ),
627
  'id' => '_lp_external_link_buy_course',
628
  'type' => 'url',
629
  'desc' => __( 'Redirect to this url when you press button buy this course.', 'learnpress' ),
756
 
757
  $meta_box = array(
758
  'id' => 'course_payment',
759
+ 'title' => __( 'Pricing', 'learnpress' ),
760
  'priority' => 'high',
761
  'pages' => array( LP_COURSE_CPT ),
762
  'icon' => 'dashicons-clipboard',
inc/custom-post-types/lesson.php CHANGED
@@ -261,6 +261,23 @@ if ( ! class_exists( 'LP_Lesson_Post_Type' ) ) {
261
  'type' => 'yes-no',
262
  'desc' => __( 'If this is a preview lesson, then student can view this lesson content without taking the course.', 'learnpress' ),
263
  'std' => 'no'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
  )
265
  )
266
  )
@@ -404,7 +421,7 @@ if ( ! class_exists( 'LP_Lesson_Post_Type' ) ) {
404
 
405
  private function _is_archive() {
406
  global $pagenow, $post_type;
407
- if ( ! is_admin() || ( $pagenow != 'edit.php' ) || ( LP_LESSON_CPT != $post_type ) ) {
408
  return false;
409
  }
410
 
261
  'type' => 'yes-no',
262
  'desc' => __( 'If this is a preview lesson, then student can view this lesson content without taking the course.', 'learnpress' ),
263
  'std' => 'no'
264
+ ),
265
+ array(
266
+ 'name' => __( 'Submission Form', 'learnpress' ),
267
+ 'id' => '_lp_submission',
268
+ 'type' => 'yes-no',
269
+ 'desc' => __( 'If this option is ON, then guess can click on the link of this lesson but only see the submission form.', 'learnpress' ),
270
+ 'std' => 'no',
271
+ 'visibility' => array(
272
+ 'state' => 'show',
273
+ 'conditional' => array(
274
+ array(
275
+ 'field' => '_lp_preview',
276
+ 'compare' => '!=',
277
+ 'value' => 'yes'
278
+ )
279
+ )
280
+ )
281
  )
282
  )
283
  )
421
 
422
  private function _is_archive() {
423
  global $pagenow, $post_type;
424
+ if ( ! is_admin() || ( $pagenow != 'edit.php' ) || ( LP_LESSON_CPT != LP_Request::get_string( 'post_type' ) ) ) {
425
  return false;
426
  }
427
 
inc/custom-post-types/order.php CHANGED
@@ -179,7 +179,7 @@ if ( ! class_exists( 'LP_Order_Post_Type' ) ) {
179
  }
180
  }
181
 
182
- return;
183
 
184
  $user_curd = new LP_User_CURD();
185
  $order_data = array();
@@ -190,7 +190,19 @@ if ( ! class_exists( 'LP_Order_Post_Type' ) ) {
190
  }
191
 
192
  foreach ( $items as $item ) {
193
- $item_course = $user->get_course_data( $item['course_id'] );
 
 
 
 
 
 
 
 
 
 
 
 
194
 
195
  if ( ! $item_course ) {
196
  continue;
@@ -260,7 +272,9 @@ if ( ! class_exists( 'LP_Order_Post_Type' ) ) {
260
  if ( ! $item_course = $user_curd->get_user_item_by_id( $user_item_id ) ) {
261
  continue;
262
  }
263
-
 
 
264
  // Restore data
265
  $user_curd->update_user_item_by_id(
266
  $user_item_id,
@@ -406,7 +420,7 @@ if ( ! class_exists( 'LP_Order_Post_Type' ) ) {
406
  }
407
 
408
  $old_status = get_post_status( $new_order->get_id() );
409
- $new_order->set_order_date( $order->get_order_date() );
410
  $new_order->set_parent_id( $order->get_id() );
411
  $new_order->set_user_id( $uid );
412
  $new_order->set_total( $order->get_total() );
@@ -514,7 +528,12 @@ if ( ! class_exists( 'LP_Order_Post_Type' ) ) {
514
  OR {$wpdb->posts}.ID LIKE %s
515
  OR orderItem.order_item_name LIKE %s
516
  ) OR ", $s, $s, $s, $s, $s, $s );
517
- $where = preg_replace( "/({$wpdb->posts}\.post_title LIKE)/", $append . '$1', $where );
 
 
 
 
 
518
 
519
  return $where;
520
  }
179
  }
180
  }
181
 
182
+ //return;
183
 
184
  $user_curd = new LP_User_CURD();
185
  $order_data = array();
190
  }
191
 
192
  foreach ( $items as $item ) {
193
+ $item = $user_curd->get_user_item(
194
+ $user_id,
195
+ $item['course_id']
196
+ );
197
+ if ( $item ) {
198
+ if ( is_array( $item ) ) {
199
+ $item_id = $item['user_item_id'];
200
+ } else {
201
+ $item_id = $item;
202
+ }
203
+ $user_curd->update_user_item_status( $item_id, 'trash' );
204
+ }
205
+ $item_course = $user->get_course_data( $item['item_id'] );
206
 
207
  if ( ! $item_course ) {
208
  continue;
272
  if ( ! $item_course = $user_curd->get_user_item_by_id( $user_item_id ) ) {
273
  continue;
274
  }
275
+ $order_status = $order->get_order_status();
276
+ $last_status = ( $order_status != '' && $order_status != 'completed' ) ? 'pending' : 'enrolled';
277
+ $user_curd->update_user_item_status( $user_item_id, $last_status );
278
  // Restore data
279
  $user_curd->update_user_item_by_id(
280
  $user_item_id,
420
  }
421
 
422
  $old_status = get_post_status( $new_order->get_id() );
423
+ $new_order->set_order_date( $order->get_order_date('edit') );
424
  $new_order->set_parent_id( $order->get_id() );
425
  $new_order->set_user_id( $uid );
426
  $new_order->set_total( $order->get_total() );
528
  OR {$wpdb->posts}.ID LIKE %s
529
  OR orderItem.order_item_name LIKE %s
530
  ) OR ", $s, $s, $s, $s, $s, $s );
531
+
532
+ if ( preg_match( "/({$wpdb->posts}\.post_title LIKE)/", $where ) ) {
533
+ $where = preg_replace( "/({$wpdb->posts}\.post_title LIKE)/", $append . '$1', $where );
534
+ } else {
535
+ $where .= " AND (" . $append . $wpdb->prepare( " {$wpdb->posts}\.post_title LIKE %s", $s ) . ")";
536
+ }
537
 
538
  return $where;
539
  }
inc/custom-post-types/question.php CHANGED
@@ -113,6 +113,15 @@ if ( ! class_exists( 'LP_Question_Post_Type' ) ) {
113
  $answers = ( $question->get_data( 'answer_options' ) ? array_values( $question->get_data( 'answer_options' ) ) : array() );
114
  }
115
 
 
 
 
 
 
 
 
 
 
116
  wp_localize_script( 'learn-press-admin-question-editor', 'lp_question_editor',
117
  apply_filters(
118
  'learn-press/question-editor/localize-script',
@@ -126,15 +135,17 @@ if ( ! class_exists( 'LP_Question_Post_Type' ) ) {
126
  'key' => $question->get_type(),
127
  'label' => $question->get_type_label()
128
  ),
129
- 'answers' => $answers,
130
  'ajax' => admin_url( '' ),
131
  'action' => 'admin_question_editor',
132
  'nonce' => wp_create_nonce( 'learnpress_admin_question_editor' ),
133
  'questionTypes' => LP_Question::get_types(),
134
  'externalComponent' => apply_filters( 'learn-press/admin/external-js-component', array() )
135
  ),
136
- 'i18n' => array(
137
- 'new_option_label' => __( 'New Option', 'learnpress' )
 
 
138
  )
139
  )
140
  )
@@ -400,8 +411,9 @@ if ( ! class_exists( 'LP_Question_Post_Type' ) ) {
400
  * @return mixed|string
401
  */
402
  public function posts_where_paged( $where ) {
 
403
 
404
- if ( ! $this->_is_archive() ) {
405
  return $where;
406
  }
407
 
@@ -423,6 +435,8 @@ if ( ! class_exists( 'LP_Question_Post_Type' ) ) {
423
  ", LP_QUESTION_CPT );
424
  }
425
 
 
 
426
  return $where;
427
  }
428
 
113
  $answers = ( $question->get_data( 'answer_options' ) ? array_values( $question->get_data( 'answer_options' ) ) : array() );
114
  }
115
 
116
+ if ( empty( $answers ) ) {
117
+ $answers = array(
118
+ array(
119
+ 'question_answer_id' => 0,
120
+ 'text' => ''
121
+ )
122
+ );
123
+ }
124
+
125
  wp_localize_script( 'learn-press-admin-question-editor', 'lp_question_editor',
126
  apply_filters(
127
  'learn-press/question-editor/localize-script',
135
  'key' => $question->get_type(),
136
  'label' => $question->get_type_label()
137
  ),
138
+ 'answers' => apply_filters( 'learn-press/question-editor/question-answers-data', $answers, $post->ID, 0 ),
139
  'ajax' => admin_url( '' ),
140
  'action' => 'admin_question_editor',
141
  'nonce' => wp_create_nonce( 'learnpress_admin_question_editor' ),
142
  'questionTypes' => LP_Question::get_types(),
143
  'externalComponent' => apply_filters( 'learn-press/admin/external-js-component', array() )
144
  ),
145
+ 'i18n' => apply_filters( 'learn-press/question-editor/i18n',
146
+ array(
147
+ 'new_option_label' => __( 'New Option', 'learnpress' )
148
+ )
149
  )
150
  )
151
  )
411
  * @return mixed|string
412
  */
413
  public function posts_where_paged( $where ) {
414
+ static $posts_where_paged = false;
415
 
416
+ if ( $posts_where_paged || ! $this->_is_archive() ) {
417
  return $where;
418
  }
419
 
435
  ", LP_QUESTION_CPT );
436
  }
437
 
438
+ $posts_where_paged = true;
439
+
440
  return $where;
441
  }
442
 
inc/custom-post-types/quiz.php CHANGED
@@ -171,16 +171,18 @@ if ( ! class_exists( 'LP_Quiz_Post_Type' ) ) {
171
  'addedItems' => array(),
172
  'items' => array()
173
  ),
174
- 'i18n' => array(
175
- 'option' => __( 'Option', 'learnpress' ),
176
- 'unique' => learn_press_uniqid(),
177
- 'back' => __( 'Back', 'learnpress' ),
178
- 'selected_items' => __( 'Selected items', 'learnpress' ),
179
- 'new_option' => __( 'New Option', 'learnpress' ),
180
- 'confirm_trash_question' => __( 'Do you want to move question "{{QUESTION_NAME}}" to trash?', 'learnpress' ),
181
- 'question_labels' => array(
182
- 'singular' => __( 'Question', 'learnpress' ),
183
- 'plural' => __( 'Questions', 'learnpress' )
 
 
184
  )
185
  ),
186
  'listQuestions' => array(
@@ -227,7 +229,7 @@ if ( ! class_exists( 'LP_Quiz_Post_Type' ) ) {
227
  'priority' => 'high',
228
  'fields' => array(
229
  array(
230
- 'name' => __( 'Show Questions', 'learnpress' ),
231
  'desc' => __( 'Show list of questions while doing quiz as ordered numbers (1, 2, 3, etc).', 'learnpress' ),
232
  'id' => '_lp_show_hide_question',
233
  'type' => 'yes_no',
@@ -450,13 +452,13 @@ if ( ! class_exists( 'LP_Quiz_Post_Type' ) ) {
450
  // $where .= $wpdb->prepare( " AND (c.ID = %d)", $course_id );
451
  // }
452
 
453
- if ( isset( $_GET['s'] ) ) {
454
- $s = $_GET['s'];
455
- $where = preg_replace(
456
- "/\.post_content\s+LIKE\s*(\'[^\']+\')\s*\)/",
457
- " .post_content LIKE '%$s%' ) OR (c.post_title LIKE '%$s%' )", $where
458
- );
459
- }
460
 
461
  if ( 'yes' === LP_Request::get( 'unassigned' ) ) {
462
  $where .= $wpdb->prepare( "
171
  'addedItems' => array(),
172
  'items' => array()
173
  ),
174
+ 'i18n' => apply_filters( 'learn-press/quiz-editor/i18n',
175
+ array(
176
+ 'option' => __( 'Option', 'learnpress' ),
177
+ 'unique' => learn_press_uniqid(),
178
+ 'back' => __( 'Back', 'learnpress' ),
179
+ 'selected_items' => __( 'Selected items', 'learnpress' ),
180
+ 'new_option' => __( 'New Option', 'learnpress' ),
181
+ 'confirm_trash_question' => __( 'Do you want to move question "{{QUESTION_NAME}}" to trash?', 'learnpress' ),
182
+ 'question_labels' => array(
183
+ 'singular' => __( 'Question', 'learnpress' ),
184
+ 'plural' => __( 'Questions', 'learnpress' )
185
+ )
186
  )
187
  ),
188
  'listQuestions' => array(
229
  'priority' => 'high',
230
  'fields' => array(
231
  array(
232
+ 'name' => __( 'Pagination Questions', 'learnpress' ),
233
  'desc' => __( 'Show list of questions while doing quiz as ordered numbers (1, 2, 3, etc).', 'learnpress' ),
234
  'id' => '_lp_show_hide_question',
235
  'type' => 'yes_no',
452
  // $where .= $wpdb->prepare( " AND (c.ID = %d)", $course_id );
453
  // }
454
 
455
+ // if ( isset( $_GET['s'] ) ) {
456
+ // $s = $_GET['s'];
457
+ // $where = preg_replace(
458
+ // "/\.post_content\s+LIKE\s*(\'[^\']+\')\s*\)/",
459
+ // " .post_content LIKE '%$s%' ) OR (c.post_title LIKE '%$s%' )", $where
460
+ // );
461
+ // }
462
 
463
  if ( 'yes' === LP_Request::get( 'unassigned' ) ) {
464
  $where .= $wpdb->prepare( "
inc/emails/_bk/class-lp-email-finished-course-admin.php DELETED
@@ -1,199 +0,0 @@
1
- <?php
2
- /**
3
- * Class LP_Email_Finished_Course_Admin
4
- *
5
- * @author ThimPress
6
- * @package LearnPress/Classes
7
- * @version 3.0.0
8
- */
9
-
10
- /**
11
- * Prevent loading this file directly
12
- */
13
- defined( 'ABSPATH' ) || exit();
14
-
15
- if ( ! class_exists( 'LP_Email_Finished_Course_Admin' ) ) {
16
-
17
- /**
18
- * Class LP_Email_Finished_Course_Admin
19
- */
20
- class LP_Email_Finished_Course_Admin extends LP_Email_Type_Finished_Course {
21
- /**
22
- * LP_Email_Finished_Course constructor.
23
- */
24
- public function __construct() {
25
- $this->id = 'finished-course-admin';
26
- $this->title = __( 'Admin', 'learnpress' );
27
- $this->description = __( 'Send this email to user when a user finished a course.', 'learnpress' );
28
-
29
-
30
- $this->default_subject = __( '[{{site_title}}] You have finished this course ({{course_name}})', 'learnpress' );
31
- $this->default_heading = __( 'Finished course', 'learnpress' );
32
-
33
- $this->support_variables = array_merge( $this->general_variables, array(
34
- '{{course_id}}',
35
- '{{course_name}}',
36
- '{{course_url}}',
37
- '{{user_id}}',
38
- '{{user_name}}',
39
- '{{user_email}}',
40
- '{{user_profile_url}}'
41
- ) );
42
-
43
- //$this->email_text_message_description = sprintf( '%s {{course_id}}, {{course_title}}, {{course_url}}, {{user_email}}, {{user_name}}, {{user_profile_url}}', __( 'Shortcodes', 'learnpress' ) );
44
-
45
- parent::__construct();
46
- }
47
-
48
- /**
49
- * Trigger email.
50
- *
51
- * @param $course_id
52
- * @param $user_id
53
- * @param $result
54
- *
55
- * @return bool
56
- */
57
- public function trigger( $course_id, $user_id, $result ) {
58
-
59
- if ( ! $this->enable || ! ( $user = learn_press_get_user( $user_id ) ) ) {
60
- return false;
61
- }
62
-
63
- $course = learn_press_get_course( $course_id );
64
- remove_filter( 'the_title', 'wptexturize' );
65
- $course_name = $course->get_title();
66
- add_filter( 'the_title', 'wptexturize' );
67
-
68
- $this->object = $this->get_common_template_data(
69
- $this->email_format,
70
- array(
71
- 'course_id' => $course_id,
72
- 'course_name' => $course_name,
73
- 'course_url' => get_the_permalink( $course_id ),
74
- 'user_id' => $user_id,
75
- 'user_name' => learn_press_get_profile_display_name( $user ),
76
- 'user_email' => $user->user_email,
77
- 'user_profile_url' => learn_press_user_profile_link( $user->get_id() )
78
- )
79
- );
80
-
81
- $this->variables = $this->data_to_variables( $this->object );
82
-
83
- $this->object['course'] = $course;
84
- $this->object['user'] = $user;
85
-
86
- $this->recipient = $user->user_email;
87
-
88
- $return = $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
89
-
90
- return $return;
91
- }
92
-
93
-
94
- /**
95
- * Get recipient.
96
- *
97
- * @return mixed|void
98
- */
99
- public function get_recipient() {
100
- if ( ! empty( $this->object['user'] ) ) {
101
- $this->recipient = $this->object['user']->user_email;
102
- }
103
-
104
- parent::get_recipient();
105
- }
106
-
107
- /**
108
- * Get email template.
109
- *
110
- * @param string $content_type
111
- *
112
- * @return array|object
113
- */
114
- public function get_template_data( $content_type = 'plain' ) {
115
- return $this->object;
116
- }
117
-
118
- /**
119
- * Admin settings.
120
- */
121
- public function get_settings() {
122
- return apply_filters(
123
- 'learn-press/email-settings/finished-course/settings',
124
- array(
125
- array(
126
- 'type' => 'heading',
127
- 'title' => $this->title,
128
- 'desc' => $this->description
129
- ),
130
- array(
131
- 'title' => __( 'Enable', 'learnpress' ),
132
- 'type' => 'yes-no',
133
- 'default' => 'no',
134
- 'id' => $this->get_field_name( 'enable' )
135
- ),
136
- array(
137
- 'title' => __( 'Subject', 'learnpress' ),
138
- 'type' => 'text',
139
- 'default' => $this->default_subject,
140
- 'id' => $this->get_field_name( 'subject' ),
141
- 'desc' => sprintf( __( 'Email subject, default: <code>%s</code>.', 'learnpress' ), $this->default_subject ),
142
- 'visibility' => array(
143
- 'state' => 'show',
144
- 'conditional' => array(
145
- array(
146
- 'field' => $this->get_field_name( 'enable' ),
147
- 'compare' => '=',
148
- 'value' => 'yes'
149
- )
150
- )
151
- )
152
- ),
153
- array(
154
- 'title' => __( 'Heading', 'learnpress' ),
155
- 'type' => 'text',
156
- 'default' => $this->default_heading,
157
- 'id' => $this->get_field_name( 'heading' ),
158
- 'desc' => sprintf( __( 'Email heading, default: <code>%s</code>.', 'learnpress' ), $this->default_heading ),
159
- 'visibility' => array(
160
- 'state' => 'show',
161
- 'conditional' => array(
162
- array(
163
- 'field' => $this->get_field_name( 'enable' ),
164
- 'compare' => '=',
165
- 'value' => 'yes'
166
- )
167
- )
168
- )
169
- ),
170
- array(
171
- 'title' => __( 'Email content', 'learnpress' ),
172
- 'type' => 'email-content',
173
- 'default' => '',
174
- 'id' => $this->get_field_name( 'email_content' ),
175
- 'template_base' => $this->template_base,
176
- 'template_path' => $this->template_path,//default learnpress
177
- 'template_html' => $this->template_html,
178
- 'template_plain' => $this->template_plain,
179
- 'template_html_local' => $this->get_theme_template_file( 'html', $this->template_path ),
180
- 'template_plain_local' => $this->get_theme_template_file( 'plain', $this->template_path ),
181
- 'support_variables' => $this->get_variables_support(),
182
- 'visibility' => array(
183
- 'state' => 'show',
184
- 'conditional' => array(
185
- array(
186
- 'field' => $this->get_field_name( 'enable' ),
187
- 'compare' => '=',
188
- 'value' => 'yes'
189
- )
190
- )
191
- )
192
- ),
193
- )
194
- );
195
- }
196
- }
197
- }
198
-
199
- return new LP_Email_Finished_Course_Admin();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/emails/_bk/class-lp-email-finished-course-instructor.php DELETED
@@ -1,201 +0,0 @@
1
- <?php
2
- /**
3
- * Class LP_Email_Finished_Course_Instructor
4
- *
5
- * @author ThimPress
6
- * @package LearnPress/Classes
7
- * @version 3.0.0
8
- */
9
-
10
- /**
11
- * Prevent loading this file directly
12
- */
13
- defined( 'ABSPATH' ) || exit();
14
-
15
- if ( ! class_exists( 'LP_Email_Finished_Course_Instructor' ) ) {
16
-
17
- /**
18
- * Class LP_Email_Finished_Course_Instructor
19
- */
20
- class LP_Email_Finished_Course_Instructor extends LP_Email {
21
- /**
22
- * LP_Email_Finished_Course constructor.
23
- */
24
- public function __construct() {
25
- $this->id = 'finished-course-instructor';
26
- $this->title = __( 'Instructor', 'learnpress' );
27
- $this->description = __( 'Send this email to user when a user finished a course.', 'learnpress' );
28
-
29
- $this->template_html = 'emails/finished-course.php';
30
- $this->template_plain = 'emails/plain/finished-course.php';
31
-
32
- $this->default_subject = __( '[{{site_title}}] You have finished this course ({{course_name}})', 'learnpress' );
33
- $this->default_heading = __( 'Finished course', 'learnpress' );
34
-
35
- $this->support_variables = array_merge( $this->general_variables, array(
36
- '{{course_id}}',
37
- '{{course_name}}',
38
- '{{course_url}}',
39
- '{{user_id}}',
40
- '{{user_name}}',
41
- '{{user_email}}',
42
- '{{user_profile_url}}'
43
- ) );
44
-
45
- //$this->email_text_message_description = sprintf( '%s {{course_id}}, {{course_title}}, {{course_url}}, {{user_email}}, {{user_name}}, {{user_profile_url}}', __( 'Shortcodes', 'learnpress' ) );
46
-
47
- parent::__construct();
48
- }
49
-
50
- /**
51
- * Trigger email.
52
- *
53
- * @param $course_id
54
- * @param $user_id
55
- * @param $result
56
- *
57
- * @return bool
58
- */
59
- public function trigger( $course_id, $user_id, $result ) {
60
-
61
- if ( ! $this->enable || ! ( $user = learn_press_get_user( $user_id ) ) ) {
62
- return false;
63
- }
64
-
65
- $course = learn_press_get_course( $course_id );
66
- remove_filter( 'the_title', 'wptexturize' );
67
- $course_name = $course->get_title();
68
- add_filter( 'the_title', 'wptexturize' );
69
-
70
- $this->object = $this->get_common_template_data(
71
- $this->email_format,
72
- array(
73
- 'course_id' => $course_id,
74
- 'course_name' => $course_name,
75
- 'course_url' => get_the_permalink( $course_id ),
76
- 'user_id' => $user_id,
77
- 'user_name' => learn_press_get_profile_display_name( $user ),
78
- 'user_email' => $user->user_email,
79
- 'user_profile_url' => learn_press_user_profile_link( $user->get_id() )
80
- )
81
- );
82
-
83
- $this->variables = $this->data_to_variables( $this->object );
84
-
85
- $this->object['course'] = $course;
86
- $this->object['user'] = $user;
87
-
88
- $this->recipient = $user->user_email;
89
-
90
- $return = $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
91
-
92
- return $return;
93
- }
94
-
95
-
96
- /**
97
- * Get recipient.
98
- *
99
- * @return mixed|void
100
- */
101
- public function get_recipient() {
102
- if ( ! empty( $this->object['user'] ) ) {
103
- $this->recipient = $this->object['user']->user_email;
104
- }
105
-
106
- parent::get_recipient();
107
- }
108
-
109
- /**
110
- * Get email template.
111
- *
112
- * @param string $content_type
113
- *
114
- * @return array|object
115
- */
116
- public function get_template_data( $content_type = 'plain' ) {
117
- return $this->object;
118
- }
119
-
120
- /**
121
- * Admin settings.
122
- */
123
- public function get_settings() {
124
- return apply_filters(
125
- 'learn-press/email-settings/finished-course/settings',
126
- array(
127
- array(
128
- 'type' => 'heading',
129
- 'title' => $this->title,
130
- 'desc' => $this->description
131
- ),
132
- array(
133
- 'title' => __( 'Enable', 'learnpress' ),
134
- 'type' => 'yes-no',
135
- 'default' => 'no',
136
- 'id' => $this->get_field_name( 'enable' )
137
- ),
138
- array(
139
- 'title' => __( 'Subject', 'learnpress' ),
140
- 'type' => 'text',
141
- 'default' => $this->default_subject,
142
- 'id' => $this->get_field_name( 'subject' ),
143
- 'desc' => sprintf( __( 'Email subject, default: <code>%s</code>.', 'learnpress' ), $this->default_subject ),
144
- 'visibility' => array(
145
- 'state' => 'show',
146
- 'conditional' => array(
147
- array(
148
- 'field' => $this->get_field_name( 'enable' ),
149
- 'compare' => '=',
150
- 'value' => 'yes'
151
- )
152
- )
153
- )
154
- ),
155
- array(
156
- 'title' => __( 'Heading', 'learnpress' ),
157
- 'type' => 'text',
158
- 'default' => $this->default_heading,
159
- 'id' => $this->get_field_name( 'heading' ),
160
- 'desc' => sprintf( __( 'Email heading, default: <code>%s</code>.', 'learnpress' ), $this->default_heading ),
161
- 'visibility' => array(
162
- 'state' => 'show',
163
- 'conditional' => array(
164
- array(
165
- 'field' => $this->get_field_name( 'enable' ),
166
- 'compare' => '=',
167
- 'value' => 'yes'
168
- )
169
- )
170
- )
171
- ),
172
- array(
173
- 'title' => __( 'Email content', 'learnpress' ),
174
- 'type' => 'email-content',
175
- 'default' => '',
176
- 'id' => $this->get_field_name( 'email_content' ),
177
- 'template_base' => $this->template_base,
178
- 'template_path' => $this->template_path,//default learnpress
179
- 'template_html' => $this->template_html,
180
- 'template_plain' => $this->template_plain,
181
- 'template_html_local' => $this->get_theme_template_file( 'html', $this->template_path ),
182
- 'template_plain_local' => $this->get_theme_template_file( 'plain', $this->template_path ),
183
- 'support_variables' => $this->get_variables_support(),
184
- 'visibility' => array(
185
- 'state' => 'show',
186
- 'conditional' => array(
187
- array(
188
- 'field' => $this->get_field_name( 'enable' ),
189
- 'compare' => '=',
190
- 'value' => 'yes'
191
- )
192
- )
193
- )
194
- ),
195
- )
196
- );
197
- }
198
- }
199
- }
200
-
201
- return new LP_Email_Finished_Course_Instructor();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/emails/_bk/class-lp-email-finished-course-user.php DELETED
@@ -1,201 +0,0 @@
1
- <?php
2
- /**
3
- * Class LP_Email_Finished_Course_User
4
- *
5
- * @author ThimPress
6
- * @package LearnPress/Classes
7
- * @version 3.0.0
8
- */
9
-
10
- /**
11
- * Prevent loading this file directly
12
- */
13
- defined( 'ABSPATH' ) || exit();
14
-
15
- if ( ! class_exists( 'LP_Email_Finished_Course_User' ) ) {
16
-
17
- /**
18
- * Class LP_Email_Finished_Course_User
19
- */
20
- class LP_Email_Finished_Course_User extends LP_Email {
21
- /**
22
- * LP_Email_Finished_Course constructor.
23
- */
24
- public function __construct() {
25
- $this->id = 'finished-course-user';
26
- $this->title = __( 'User', 'learnpress' );
27
- $this->description = __( 'Send this email to user when a user finished a course.', 'learnpress' );
28
-
29
- $this->template_html = 'emails/finished-course.php';
30
- $this->template_plain = 'emails/plain/finished-course.php';
31
-
32
- $this->default_subject = __( '[{{site_title}}] You have finished this course ({{course_name}})', 'learnpress' );
33
- $this->default_heading = __( 'Finished course', 'learnpress' );
34
-
35
- $this->support_variables = array_merge( $this->general_variables, array(
36
- '{{course_id}}',
37
- '{{course_name}}',
38
- '{{course_url}}',
39
- '{{user_id}}',
40
- '{{user_name}}',
41
- '{{user_email}}',
42
- '{{user_profile_url}}'
43
- ) );
44
-
45
- //$this->email_text_message_description = sprintf( '%s {{course_id}}, {{course_title}}, {{course_url}}, {{user_email}}, {{user_name}}, {{user_profile_url}}', __( 'Shortcodes', 'learnpress' ) );
46
-
47
- parent::__construct();
48
- }
49
-
50
- /**
51
- * Trigger email.
52
- *
53
- * @param $course_id
54
- * @param $user_id
55
- * @param $result
56
- *
57
- * @return bool
58
- */
59
- public function trigger( $course_id, $user_id, $result ) {
60
-
61
- if ( ! $this->enable || ! ( $user = learn_press_get_user( $user_id ) ) ) {
62
- return false;
63
- }
64
-
65
- $course = learn_press_get_course( $course_id );
66
- remove_filter( 'the_title', 'wptexturize' );
67
- $course_name = $course->get_title();
68
- add_filter( 'the_title', 'wptexturize' );
69
-
70
- $this->object = $this->get_common_template_data(
71
- $this->email_format,
72
- array(
73
- 'course_id' => $course_id,
74
- 'course_name' => $course_name,
75
- 'course_url' => get_the_permalink( $course_id ),
76
- 'user_id' => $user_id,
77
- 'user_name' => learn_press_get_profile_display_name( $user ),
78
- 'user_email' => $user->user_email,
79
- 'user_profile_url' => learn_press_user_profile_link( $user->get_id() )
80
- )
81
- );
82
-
83
- $this->variables = $this->data_to_variables( $this->object );
84
-
85
- $this->object['course'] = $course;
86
- $this->object['user'] = $user;
87
-
88
- $this->recipient = $user->user_email;
89
-
90
- $return = $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
91
-
92
- return $return;
93
- }
94
-
95
-
96
- /**
97
- * Get recipient.
98
- *
99
- * @return mixed|void
100
- */
101
- public function get_recipient() {
102
- if ( ! empty( $this->object['user'] ) ) {
103
- $this->recipient = $this->object['user']->user_email;
104
- }
105
-
106
- parent::get_recipient();
107
- }
108
-
109
- /**
110
- * Get email template.
111
- *
112
- * @param string $content_type
113
- *
114
- * @return array|object
115
- */
116
- public function get_template_data( $content_type = 'plain' ) {
117
- return $this->object;
118
- }
119
-
120
- /**
121
- * Admin settings.
122
- */
123
- public function get_settings() {
124
- return apply_filters(
125
- 'learn-press/email-settings/finished-course/settings',
126
- array(
127
- array(
128
- 'type' => 'heading',
129
- 'title' => $this->title,
130
- 'desc' => $this->description
131
- ),
132
- array(
133
- 'title' => __( 'Enable', 'learnpress' ),
134
- 'type' => 'yes-no',
135
- 'default' => 'no',
136
- 'id' => $this->get_field_name( 'enable' )
137
- ),
138
- array(
139
- 'title' => __( 'Subject', 'learnpress' ),
140
- 'type' => 'text',
141
- 'default' => $this->default_subject,
142
- 'id' => $this->get_field_name( 'subject' ),
143
- 'desc' => sprintf( __( 'Email subject, default: <code>%s</code>.', 'learnpress' ), $this->default_subject ),
144
- 'visibility' => array(
145
- 'state' => 'show',
146
- 'conditional' => array(
147
- array(
148
- 'field' => $this->get_field_name( 'enable' ),
149
- 'compare' => '=',
150
- 'value' => 'yes'
151
- )
152
- )
153
- )
154
- ),
155
- array(
156
- 'title' => __( 'Heading', 'learnpress' ),
157
- 'type' => 'text',
158
- 'default' => $this->default_heading,
159
- 'id' => $this->get_field_name( 'heading' ),
160
- 'desc' => sprintf( __( 'Email heading, default: <code>%s</code>.', 'learnpress' ), $this->default_heading ),
161
- 'visibility' => array(
162
- 'state' => 'show',
163
- 'conditional' => array(
164
- array(
165
- 'field' => $this->get_field_name( 'enable' ),
166
- 'compare' => '=',
167
- 'value' => 'yes'
168
- )
169
- )
170
- )
171
- ),
172
- array(
173
- 'title' => __( 'Email content', 'learnpress' ),
174
- 'type' => 'email-content',
175
- 'default' => '',
176
- 'id' => $this->get_field_name( 'email_content' ),
177
- 'template_base' => $this->template_base,
178
- 'template_path' => $this->template_path,//default learnpress
179
- 'template_html' => $this->template_html,
180
- 'template_plain' => $this->template_plain,
181
- 'template_html_local' => $this->get_theme_template_file( 'html', $this->template_path ),
182
- 'template_plain_local' => $this->get_theme_template_file( 'plain', $this->template_path ),
183
- 'support_variables' => $this->get_variables_support(),
184
- 'visibility' => array(
185
- 'state' => 'show',
186
- 'conditional' => array(
187
- array(
188
- 'field' => $this->get_field_name( 'enable' ),
189
- 'compare' => '=',
190
- 'value' => 'yes'
191
- )
192
- )
193
- )
194
- ),
195
- )
196
- );
197
- }
198
- }
199
- }
200
-
201
- return new LP_Email_Finished_Course_User();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/emails/class-lp-email-new-order-admin.php CHANGED
@@ -37,6 +37,10 @@ if ( ! class_exists( 'LP_Email_New_Order_Admin' ) ) {
37
 
38
  // new free order
39
  // add_action( 'learn-press/order/status-pending-to-completed/notification', array( $this, 'trigger' ) );
 
 
 
 
40
  // new paid order
41
  add_action( 'learn-press/order/status-pending-to-processing/notification', array( $this, 'trigger' ) );
42
 
@@ -46,11 +50,14 @@ if ( ! class_exists( 'LP_Email_New_Order_Admin' ) ) {
46
  add_action( 'init', array( $this, 'init' ) );
47
  }
48
 
49
- public function init(){
50
  // disable send mail for enable enroll course admin mail
51
- $email = LP_Emails::get_email('enrolled-course-admin');
52
  if ( $email->enable() ) {
53
- remove_action( 'learn-press/order/status-pending-to-completed/notification', array( $this, 'trigger' ) );
 
 
 
54
  }
55
  }
56
 
37
 
38
  // new free order
39
  // add_action( 'learn-press/order/status-pending-to-completed/notification', array( $this, 'trigger' ) );
40
+
41
+ // email for new order
42
+ add_action( 'learn-press/checkout-order-processed', array( $this, 'trigger' ) );
43
+
44
  // new paid order
45
  add_action( 'learn-press/order/status-pending-to-processing/notification', array( $this, 'trigger' ) );
46
 
50
  add_action( 'init', array( $this, 'init' ) );
51
  }
52
 
53
+ public function init() {
54
  // disable send mail for enable enroll course admin mail
55
+ $email = LP_Emails::get_email( 'enrolled-course-admin' );
56
  if ( $email->enable() ) {
57
+ remove_action( 'learn-press/order/status-pending-to-completed/notification', array(
58
+ $this,
59
+ 'trigger'
60
+ ) );
61
  }
62
  }
63
 
inc/emails/class-lp-email.php CHANGED
@@ -322,10 +322,22 @@ if ( ! class_exists( 'LP_Email' ) ) {
322
  /**
323
  * Init general options
324
  */
325
- $this->heading = $this->settings->get( 'heading', $this->default_heading );
326
- $this->subject = $this->settings->get( 'subject', $this->default_subject );
327
- $this->email_format = $this->settings->get( 'email_content.format' ) == 'plain_text' ? 'plain' : 'html';
328
- $this->enable = $this->settings->get( 'enable' ) === 'yes';
 
 
 
 
 
 
 
 
 
 
 
 
329
 
330
  $this->basic_variables = array(
331
  '{{site_url}}',
@@ -346,6 +358,8 @@ if ( ! class_exists( 'LP_Email' ) ) {
346
  );
347
 
348
  $this->support_variables = $this->general_variables;
 
 
349
  }
350
 
351
  /**
@@ -691,17 +705,9 @@ if ( ! class_exists( 'LP_Email' ) ) {
691
  * @return string
692
  */
693
  public function get_image_header() {
694
- $image = LP()->settings->get( 'emails_general.header_image' );
695
-
696
- if ( is_array( $image ) ) {
697
- $image = reset( $image );
698
- }
699
-
700
- if ( is_numeric( $image ) ) {
701
- $image = wp_get_attachment_image_url( $image, 'full' );
702
- }
703
 
704
- return $image;
705
  }
706
 
707
  /**
@@ -900,11 +906,16 @@ if ( ! class_exists( 'LP_Email' ) ) {
900
  * @return array
901
  */
902
  public function get_common_template_data( $format = 'plain' ) {
 
 
 
 
903
  $heading = strip_tags( $this->get_heading() );
904
  $footer_text = strip_tags( $this->get_footer_text() );
 
905
  if ( $format != 'plain' ) {
906
- $header = LP_Emails::instance()->email_header( $heading, false );
907
- $footer = LP_Emails::instance()->email_footer( $footer_text, false );
908
  } else {
909
  $header = $heading;
910
  $footer = $footer_text;
@@ -923,6 +934,7 @@ if ( ! class_exists( 'LP_Email' ) ) {
923
  'login_url' => learn_press_get_login_url(),
924
  'plain_text' => $format == 'plain'
925
  );
 
926
  if ( ( $num = func_num_args() ) > 1 ) {
927
  for ( $i = 1; $i < $num; $i ++ ) {
928
  $a = func_get_arg( $i );
@@ -932,6 +944,8 @@ if ( ! class_exists( 'LP_Email' ) ) {
932
  }
933
  }
934
 
 
 
935
  return $common;
936
  }
937
 
322
  /**
323
  * Init general options
324
  */
325
+ $this->heading = $this->settings->get( 'heading', $this->default_heading );
326
+ $this->subject = $this->settings->get( 'subject', $this->default_subject );
327
+ $this->enable = $this->settings->get( 'enable' ) === 'yes';
328
+
329
+ if ( $format = $this->settings->get( 'email_content.format' ) ) {
330
+ $this->email_format = $format == 'plain_text' ? 'plain' : 'html';
331
+ } else {
332
+ if ( $format = LP()->settings->get( 'emails_general.default_email_content' ) ) {
333
+ $this->email_format = $format;
334
+ }
335
+ }
336
+
337
+ $email_formats = array( 'plain', 'html' );
338
+ if ( ! in_array( $this->email_format, $email_formats ) ) {
339
+ $this->email_format = 'plain';
340
+ }
341
 
342
  $this->basic_variables = array(
343
  '{{site_url}}',
358
  );
359
 
360
  $this->support_variables = $this->general_variables;
361
+
362
+ //echo "[", get_class($this), ']';
363
  }
364
 
365
  /**
705
  * @return string
706
  */
707
  public function get_image_header() {
708
+ $image = LP_Emails::instance()->get_image_header();
 
 
 
 
 
 
 
 
709
 
710
+ return apply_filters( 'learn-press/email-image-header-' . $this->id, $image );
711
  }
712
 
713
  /**
906
  * @return array
907
  */
908
  public function get_common_template_data( $format = 'plain' ) {
909
+
910
+ $emails = LP_Emails::instance();
911
+ $emails->set_current( $this );
912
+
913
  $heading = strip_tags( $this->get_heading() );
914
  $footer_text = strip_tags( $this->get_footer_text() );
915
+
916
  if ( $format != 'plain' ) {
917
+ $header = $emails->email_header( $heading, false );
918
+ $footer = $emails->email_footer( $footer_text, false );
919
  } else {
920
  $header = $heading;
921
  $footer = $footer_text;
934
  'login_url' => learn_press_get_login_url(),
935
  'plain_text' => $format == 'plain'
936
  );
937
+
938
  if ( ( $num = func_num_args() ) > 1 ) {
939
  for ( $i = 1; $i < $num; $i ++ ) {
940
  $a = func_get_arg( $i );
944
  }
945
  }
946
 
947
+ $emails->reset_current();
948
+
949
  return $common;
950
  }
951
 
inc/emails/types/class-lp-email-type-enrolled-course.php CHANGED
@@ -1,4 +1,17 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  /**
4
  * Class LP_Email_Type_Enrolled_Course
@@ -43,6 +56,10 @@ class LP_Email_Type_Enrolled_Course extends LP_Email {
43
  )
44
  );
45
 
 
 
 
 
46
  add_action( 'learn_press_user_enrolled_course_notification', array( $this, 'trigger' ), 99, 3 );
47
  add_action( 'learn-press/user-enrolled-course/notification', array( $this, 'trigger' ), 99, 3 );
48
 
@@ -118,4 +135,27 @@ class LP_Email_Type_Enrolled_Course extends LP_Email {
118
 
119
  LP_Emails::instance()->set_current( $this->id );
120
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  }
1
  <?php
2
+ /**
3
+ * LP_Email_Type_Enrolled_Course.
4
+ *
5
+ * @author ThimPress
6
+ * @package Learnpress/Classes
7
+ * @extends LP_Email
8
+ * @version 3.0.9
9
+ */
10
+
11
+ /**
12
+ * Prevent loading this file directly
13
+ */
14
+ defined( 'ABSPATH' ) || exit();
15
 
16
  /**
17
  * Class LP_Email_Type_Enrolled_Course
56
  )
57
  );
58
 
59
+ if ( LP()->settings->get( 'auto_enroll' ) == 'yes' ) {
60
+ add_action( 'learn-press/order/status-completed', array( $this, 'auto_enroll_trigger' ), 10, 2 );
61
+ }
62
+
63
  add_action( 'learn_press_user_enrolled_course_notification', array( $this, 'trigger' ), 99, 3 );
64
  add_action( 'learn-press/user-enrolled-course/notification', array( $this, 'trigger' ), 99, 3 );
65
 
135
 
136
  LP_Emails::instance()->set_current( $this->id );
137
  }
138
+
139
+ /**
140
+ * @param $order_id
141
+ */
142
+ public function auto_enroll_trigger( $order_id, $status ) {
143
+
144
+ if ( ! $this->enable ) {
145
+ return;
146
+ }
147
+
148
+ $order = learn_press_get_order( $order_id );
149
+ $user = $order->get_user();
150
+ $courses = $order->get_items();
151
+
152
+ if ( $courses ) {
153
+ foreach ( $courses as $course ) {
154
+ $course_id = $course['course_id'];
155
+
156
+ $course_data = new LP_User_Item_Course( $course_id );
157
+ $this->trigger( $course_id, $user->get_id(), $course_data->get_item_id() );
158
+ }
159
+ }
160
+ }
161
  }
inc/lesson/class-lp-lesson.php CHANGED
@@ -93,6 +93,7 @@ if ( ! function_exists( 'LP_Lesson' ) ) {
93
  * @throws Exception
94
  */
95
  public function is( $tag ) {
 
96
  $args = func_get_args();
97
  unset( $args[0] );
98
  $method = 'is_' . preg_replace( '!-!', '_', $tag );
93
  * @throws Exception
94
  */
95
  public function is( $tag ) {
96
+ _deprecated_function( __FUNCTION__, '3.0.8' );
97
  $args = func_get_args();
98
  unset( $args[0] );
99
  $method = 'is_' . preg_replace( '!-!', '_', $tag );
inc/lesson/lp-lesson-functions.php CHANGED
@@ -52,15 +52,19 @@ function learn_press_lesson_comment_form() {
52
  if ( comments_open() || get_comments_number() ) {
53
  comments_template();
54
  }
55
-
56
  $lesson->reset_postdata();
57
  }
 
 
 
 
 
58
  }
59
 
60
  /**
61
  * Add class css js-action to element comment reply
62
  */
63
- add_filter( 'comment_reply_link', 'lesson_comment_reply_link', 10, 4 );
64
 
65
  if ( ! function_exists( 'lesson_comment_reply_link' ) ) {
66
 
@@ -75,7 +79,7 @@ if ( ! function_exists( 'lesson_comment_reply_link' ) ) {
75
  /**
76
  * Add class css js-action to element cancel comment reply link
77
  */
78
- add_filter( 'cancel_comment_reply_link', 'lesson_cancel_comment_reply_link', 10, 3 );
79
 
80
  if ( ! function_exists( 'lesson_cancel_comment_reply_link' ) ) {
81
  function lesson_cancel_comment_reply_link( $formatted_link, $link, $text ) {
52
  if ( comments_open() || get_comments_number() ) {
53
  comments_template();
54
  }
 
55
  $lesson->reset_postdata();
56
  }
57
+
58
+ }
59
+
60
+ function learn_press_blank_comments_template() {
61
+ return learn_press_locate_template( 'global/blank-comments.php' );
62
  }
63
 
64
  /**
65
  * Add class css js-action to element comment reply
66
  */
67
+ ///add_filter( 'comment_reply_link', 'lesson_comment_reply_link', 10, 4 );
68
 
69
  if ( ! function_exists( 'lesson_comment_reply_link' ) ) {
70
 
79
  /**
80
  * Add class css js-action to element cancel comment reply link
81
  */
82
+ ///add_filter( 'cancel_comment_reply_link', 'lesson_cancel_comment_reply_link', 10, 3 );
83
 
84
  if ( ! function_exists( 'lesson_cancel_comment_reply_link' ) ) {
85
  function lesson_cancel_comment_reply_link( $formatted_link, $link, $text ) {
inc/lp-constants.php CHANGED
@@ -4,7 +4,7 @@
4
  */
5
  $upload_dir = wp_upload_dir();
6
  // version
7
- define( 'LEARNPRESS_VERSION', '3.0.7' );
8
 
9
  define( 'LP_WP_CONTENT', basename( WP_CONTENT_DIR ) );
10
 
@@ -55,4 +55,9 @@ define( 'LP_INVALID_QUIZ_OR_COURSE', 140 );
55
  define( 'LP_COURSE_IS_FINISHED', 150 );
56
  define( 'LP_QUIZ_HAS_STARTED_OR_COMPLETED', 160 );
57
  define( 'LP_ERROR_NO_PAYMENT_METHOD_SELECTED', 1000 );
58
- define( 'LP_DEBUG_DEV', false );
 
 
 
 
 
4
  */
5
  $upload_dir = wp_upload_dir();
6
  // version
7
+ define( 'LEARNPRESS_VERSION', '3.0.8' );
8
 
9
  define( 'LP_WP_CONTENT', basename( WP_CONTENT_DIR ) );
10
 
55
  define( 'LP_COURSE_IS_FINISHED', 150 );
56
  define( 'LP_QUIZ_HAS_STARTED_OR_COMPLETED', 160 );
57
  define( 'LP_ERROR_NO_PAYMENT_METHOD_SELECTED', 1000 );
58
+ define( 'LP_DEBUG_DEV', false );
59
+
60
+ /**
61
+ * Thim Market library
62
+ */
63
+ define( 'TMP_ROOT', LP_PLUGIN_PATH . 'inc/libraries/' );
inc/lp-core-functions.php CHANGED
@@ -2172,12 +2172,17 @@ if ( ! function_exists( 'learn_press_reset_auto_increment' ) ) {
2172
  }
2173
 
2174
  /**
2175
- * @param $handle
 
2176
  *
2177
  * @return string
2178
  */
2179
- function learn_press_get_log_file_path( $handle ) {
2180
- return trailingslashit( LP_LOG_PATH ) . $handle . '-' . sanitize_file_name( wp_hash( $handle ) ) . '.log';
 
 
 
 
2181
  }
2182
 
2183
  /**
@@ -2391,7 +2396,7 @@ function learn_press_auto_enroll_user_to_courses( $order_id ) {
2391
  if ( ! $user->is_exists() ) {
2392
  continue;
2393
  }
2394
- if ( $user->has( 'enrolled-course', $course->get_id() ) ) {
2395
  continue;
2396
  }
2397
  // error. this scripts will create new order each course item
@@ -2763,31 +2768,33 @@ if ( ! function_exists( 'learn_press_is_negative_value' ) ) {
2763
  * @return string
2764
  */
2765
  function learn_press_comment_reply_link( $link, $args = array(), $comment = null, $post = null ) {
2766
- $post_types = array( LP_LESSON_CPT, LP_QUIZ_CPT );
2767
- $post_type = get_post_type( $post );
2768
 
2769
- if ( in_array( $post_type, $post_types ) ) {
2770
 
2771
- if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) {
2772
- $link = sprintf( '<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>',
2773
- esc_url( wp_login_url( get_permalink() ) ),
2774
- $args['login_text']
2775
- );
2776
- } else {
2777
- $onclick = sprintf( 'return addComment.moveForm( "%1$s-%2$s", "%2$s", "%3$s", "%4$s" )',
2778
- $args['add_below'], $comment->comment_ID, $args['respond_id'], $post->ID
2779
- );
2780
-
2781
- $link = sprintf( "<a rel='nofollow' class='comment-reply-link' href='%s' onclick='%s' aria-label='%s'>%s</a>",
2782
- esc_url( add_query_arg( array(
2783
- 'replytocom' => $comment->comment_ID,
2784
- 'content-item-only' => 'yes'
2785
- ), get_permalink( $post->ID ) ) ) . "#" . $args['respond_id'],
2786
- $onclick,
2787
- esc_attr( sprintf( $args['reply_to_text'], $comment->comment_author ) ),
2788
- $args['reply_text']
2789
- );
2790
- }
 
 
 
 
2791
  }
2792
 
2793
  return $link;
@@ -3064,7 +3071,7 @@ function learn_press_get_unassigned_questions() {
3064
  INNER JOIN {$wpdb->posts} p ON p.ID = qq.question_id
3065
  WHERE p.post_type = %s
3066
  )
3067
- AND p.post_type NOT IN(%s, %s)
3068
  ", LP_QUESTION_CPT, LP_QUESTION_CPT, 'auto-draft', 'trash' );
3069
 
3070
  $questions = $wpdb->get_col( $query );
@@ -3133,3 +3140,56 @@ function learn_press_date_i18n( $timestamp = '', $format = '', $gmt = false ) {
3133
 
3134
  return date_i18n( $format, $timestamp, $gmt );
3135
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2172
  }
2173
 
2174
  /**
2175
+ * @param string $handle
2176
+ * @param bool $hash
2177
  *
2178
  * @return string
2179
  */
2180
+ function learn_press_get_log_file_path( $handle, $hash = false ) {
2181
+ if ( $hash ) {
2182
+ $hash = '-' . sanitize_file_name( wp_hash( $handle ) );
2183
+ }
2184
+
2185
+ return trailingslashit( LP_LOG_PATH ) . $handle . $hash . '.log';
2186
  }
2187
 
2188
  /**
2396
  if ( ! $user->is_exists() ) {
2397
  continue;
2398
  }
2399
+ if ( $user->has_enrolled_course( $course->get_id() ) ) {
2400
  continue;
2401
  }
2402
  // error. this scripts will create new order each course item
2768
  * @return string
2769
  */
2770
  function learn_press_comment_reply_link( $link, $args = array(), $comment = null, $post = null ) {
 
 
2771
 
2772
+ $post_type = get_post_type( $post );
2773
 
2774
+ if ( ! learn_press_is_support_course_item_type( $post_type ) ) {
2775
+ return $link;
2776
+ }
2777
+
2778
+ $course_item = LP_Global::course_item();
2779
+
2780
+ if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) {
2781
+ $link = sprintf( '<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>',
2782
+ esc_url( wp_login_url( get_permalink() ) ),
2783
+ $args['login_text']
2784
+ );
2785
+ } else {
2786
+ $onclick = sprintf( 'return addComment.moveForm( "%1$s-%2$s", "%2$s", "%3$s", "%4$s" )',
2787
+ $args['add_below'], $comment->comment_ID, $args['respond_id'], $post->ID
2788
+ );
2789
+
2790
+ $link = sprintf( "<a rel='nofollow' class='comment-reply-link' href='%s' onclick='%s' aria-label='%s'>%s</a>",
2791
+ esc_url( add_query_arg( array(
2792
+ 'replytocom' => $comment->comment_ID
2793
+ ), $course_item->get_permalink() ) ) . "#" . $args['respond_id'],
2794
+ $onclick,
2795
+ esc_attr( sprintf( $args['reply_to_text'], $comment->comment_author ) ),
2796
+ $args['reply_text']
2797
+ );
2798
  }
2799
 
2800
  return $link;
3071
  INNER JOIN {$wpdb->posts} p ON p.ID = qq.question_id
3072
  WHERE p.post_type = %s
3073
  )
3074
+ AND p.post_status NOT IN(%s, %s)
3075
  ", LP_QUESTION_CPT, LP_QUESTION_CPT, 'auto-draft', 'trash' );
3076
 
3077
  $questions = $wpdb->get_col( $query );
3140
 
3141
  return date_i18n( $format, $timestamp, $gmt );
3142
  }
3143
+
3144
+ /**
3145
+ * Remove user items.
3146
+ *
3147
+ * @since 3.0.8
3148
+ *
3149
+ * @param int $item_id
3150
+ * @param int $course_id
3151
+ * @param int $user_id
3152
+ * @param int $keep
3153
+ */
3154
+ function learn_press_remove_user_items_history( $item_id, $course_id, $user_id, $keep = 10 ) {
3155
+
3156
+ $user = learn_press_get_user( $user_id );
3157
+ if ( $rows = $user->get_item_archive( $item_id, $course_id ) ) {
3158
+
3159
+ global $wpdb;
3160
+
3161
+ $args = array( $user_id, $item_id, $course_id );
3162
+ $query = $wpdb->prepare( "
3163
+ DELETE
3164
+ FROM {$wpdb->learnpress_user_items}
3165
+ WHERE user_id = %d AND item_id = %d
3166
+ AND ref_id = %d
3167
+ ", $args );
3168
+
3169
+ if ( $keep ) {
3170
+ $user_item_ids = array_keys( $rows );
3171
+ $user_item_ids = array_splice( $user_item_ids, 0, $keep );
3172
+ $format = array_fill( 0, sizeof( $user_item_ids ), '%d' );
3173
+
3174
+ $query .= $wpdb->prepare( " AND user_item_id NOT IN(" . join( ',', $format ) . ")", $user_item_ids );
3175
+ }
3176
+
3177
+ $wpdb->query( $query );
3178
+ }
3179
+ }
3180
+
3181
+ /**
3182
+ * Get item types of course support for blocking. Default is lp_lesson
3183
+ *
3184
+ * @since 3.0.0
3185
+ *
3186
+ * @return array
3187
+ */
3188
+ function learn_press_get_block_course_item_types() {
3189
+ return apply_filters( 'learn-press/block-course-item-types', array( LP_LESSON_CPT ) );
3190
+ }
3191
+
3192
+ //add_filter('learn-press/block-course-item-types', function ($a){
3193
+ // $a[] = LP_QUIZ_CPT;
3194
+ // return $a;
3195
+ //});
inc/lp-template-functions.php CHANGED
@@ -216,7 +216,7 @@ if ( ! function_exists( 'learn_press_course_external_button' ) ) {
216
  $user = learn_press_get_current_user();
217
 
218
  if ( ! $user->has_enrolled_course( $course->get_id() ) ) {
219
- // Remove all other buttons
220
  learn_press_remove_course_buttons();
221
  learn_press_get_template( 'single-course/buttons/external-link.php' );
222
  // Add back other buttons for other courses
@@ -372,7 +372,7 @@ if ( ! function_exists( 'learn_press_user_profile_header' ) ) {
372
  if ( $profile->get_user()->is_guest() ) {
373
  return;
374
  }
375
-
376
  learn_press_get_template( 'profile/profile-cover.php', array( 'user' => $user ) );
377
  }
378
  }
@@ -514,10 +514,19 @@ if ( ! function_exists( 'learn_press_course_item_content' ) ) {
514
  */
515
  function learn_press_course_item_content() {
516
  global $lp_course, $lp_course_item;
517
- $item_template_name = learn_press_locate_template( 'single-course/content-item-' . $lp_course_item->get_item_type() . '.php' );
 
 
 
 
 
 
 
 
 
518
 
519
  if ( file_exists( $item_template_name ) ) {
520
- learn_press_get_template( 'single-course/content-item-' . $lp_course_item->get_item_type() . '.php' );
521
  }
522
  }
523
  }
@@ -1565,24 +1574,6 @@ if ( ! function_exists( 'learn_press_content_single_course' ) ) {
1565
  }
1566
  }
1567
 
1568
- if ( ! function_exists( 'learn_press_course_enroll_button' ) ) {
1569
- /**
1570
- * Display course enroll button
1571
- */
1572
- function learn_press_course_enroll_button() {
1573
- learn_press_get_template( 'single-course/enroll-button.php' );
1574
- }
1575
- }
1576
-
1577
- if ( ! function_exists( 'learn_press_course_retake_button' ) ) {
1578
- /**
1579
- * Display course retake button
1580
- */
1581
- function learn_press_course_retake_button() {
1582
- learn_press_get_template( 'single-course/retake-button.php' );
1583
- }
1584
- }
1585
-
1586
  if ( ! function_exists( 'learn_press_course_buttons' ) ) {
1587
  /**
1588
  * Display course retake button
@@ -1971,7 +1962,7 @@ if ( ! function_exists( 'learn_press_course_lesson_class' ) ) {
1971
  if ( $status = $user->get_item_status( $lesson_id ) ) {
1972
  $classes[] = "item-has-status item-{$status}";
1973
  }
1974
- if ( $lesson_id && $course->is( 'current-item', $lesson_id ) ) {
1975
  $classes[] = 'item-current';
1976
  }
1977
  if ( learn_press_is_course() ) {
@@ -1984,7 +1975,7 @@ if ( ! function_exists( 'learn_press_course_lesson_class' ) ) {
1984
  $classes[] = 'preview-item';
1985
  }
1986
 
1987
- if ( $user->can( 'view-item', $lesson_id, $course_id ) ) {
1988
  $classes[] = 'viewable';
1989
  }
1990
 
@@ -2032,11 +2023,11 @@ if ( ! function_exists( 'learn_press_course_quiz_class' ) ) {
2032
  $classes[] = "item-has-status item-{$status}";
2033
  }
2034
 
2035
- if ( $quiz_id && $course->is( 'current-item', $quiz_id ) ) {
2036
  $classes[] = 'item-current';
2037
  }
2038
 
2039
- if ( $user->can( 'view-item', $quiz_id, $course_id ) ) {
2040
  $classes[] = 'viewable';
2041
  }
2042
 
@@ -2150,15 +2141,15 @@ if ( ! is_admin() ) {
2150
  function learn_press_display_message( $message, $type = 'success' ) {
2151
 
2152
  // get all messages added into queue
2153
- $messages = learn_press_session_get( 'messages' );
2154
- learn_press_session_set( 'messages', null );
2155
 
2156
  // add new notice and display
2157
  learn_press_add_message( $message, $type );
2158
  echo learn_press_get_messages( true );
2159
 
2160
  // store back messages
2161
- learn_press_session_set( 'messages', $messages );
2162
  }
2163
 
2164
  /**
@@ -2178,11 +2169,12 @@ function learn_press_get_messages( $clear = false ) {
2178
  /**
2179
  * Add new message into queue for displaying.
2180
  *
2181
- * @param string $message
2182
- * @param string $type
2183
- * @param array $options
 
2184
  */
2185
- function learn_press_add_message( $message, $type = 'success', $options = array() ) {
2186
 
2187
  if ( is_string( $options ) ) {
2188
  $options = array( 'id' => $options );
@@ -2195,13 +2187,23 @@ function learn_press_add_message( $message, $type = 'success', $options = array(
2195
  )
2196
  );
2197
 
2198
- $messages = learn_press_session_get( 'messages' );
 
 
 
 
 
 
 
 
 
2199
  if ( empty( $messages[ $type ] ) ) {
2200
  $messages[ $type ] = array();
2201
  }
 
2202
  $messages[ $type ][ $options['id'] ] = array( 'content' => $message, 'options' => $options );
2203
 
2204
- learn_press_session_set( 'messages', $messages );
2205
  }
2206
 
2207
  function learn_press_get_message( $message, $type = 'success' ) {
@@ -2221,7 +2223,7 @@ function learn_press_get_message( $message, $type = 'success' ) {
2221
  * @param string|array $type
2222
  */
2223
  function learn_press_remove_message( $id = '', $type = '' ) {
2224
- if ( ! $groups = learn_press_session_get( 'messages' ) ) {
2225
  return;
2226
  }
2227
 
@@ -2249,7 +2251,7 @@ function learn_press_remove_message( $id = '', $type = '' ) {
2249
  $groups = array();
2250
  }
2251
 
2252
- learn_press_session_set( 'messages', $groups );
2253
  }
2254
 
2255
  /**
@@ -2258,16 +2260,16 @@ function learn_press_remove_message( $id = '', $type = '' ) {
2258
  * @param bool
2259
  */
2260
  function learn_press_print_messages( $clear = true ) {
2261
- $messages = learn_press_session_get( 'messages' );
2262
  learn_press_get_template( 'global/message.php', array( 'messages' => $messages ) );
2263
  if ( $clear ) {
2264
- learn_press_session_set( 'messages', array() );
2265
  }
2266
  }
2267
 
2268
  function learn_press_message_count( $type = '' ) {
2269
  $count = 0;
2270
- $messages = learn_press_session_get( 'messages', array() );
2271
 
2272
  if ( isset( $messages[ $type ] ) ) {
2273
  $count = absint( sizeof( $messages[ $type ] ) );
@@ -2280,6 +2282,10 @@ function learn_press_message_count( $type = '' ) {
2280
  return $count;
2281
  }
2282
 
 
 
 
 
2283
  function learn_press_clear_messages() {
2284
  _deprecated_function( __FUNCTION__, '3.0.0', 'learn_press_remove_message' );
2285
  learn_press_remove_message();
@@ -2325,7 +2331,7 @@ if ( ! function_exists( 'learn_press_page_controller' ) ) {
2325
  $quiz_status = LP()->user->get_quiz_status( get_the_ID() );
2326
  $redirect = false;
2327
  $error_message = false;
2328
- if ( ! $user->can( 'view-quiz', $quiz->id ) ) {
2329
  if ( $course = $quiz->get_course() ) {
2330
  $redirect = $course->permalink;
2331
  $error_message = sprintf( __( 'Access denied "%s"', 'learnpress' ) );
@@ -2341,8 +2347,8 @@ if ( ! function_exists( 'learn_press_page_controller' ) ) {
2341
  $redirect = apply_filters( 'learn_press_quiz_access_denied_redirect_permalink', $redirect, $quiz_status, $quiz->id, $user->get_id() );
2342
  break;
2343
  case LP_COURSE_CPT:
2344
- if ( ( $course = learn_press_get_course() ) && $item_id = $course->is( 'viewing-item' ) ) {
2345
- if ( ! LP()->user->can( 'view-item', $item_id ) ) {
2346
  $redirect = apply_filters( 'learn_press_lesson_access_denied_redirect_permalink', $course->permalink, $item_id, $user->get_id() );
2347
  }
2348
  }
@@ -2621,7 +2627,7 @@ function learn_press_permission_view_quiz( $template ) {
2621
  }
2622
  $user = learn_press_get_current_user();
2623
  // If user haven't got permission
2624
- if ( ! current_user_can( 'edit-lp_quiz' ) && ! $user->can( 'view-quiz', $quiz->id ) ) {
2625
  switch ( LP()->settings->get( 'quiz_restrict_access' ) ) {
2626
  case 'custom':
2627
  $template = learn_press_locate_template( 'global/restrict-access.php' );
@@ -2850,7 +2856,7 @@ if ( ! function_exists( 'learn_press_content_item_lesson_title' ) ) {
2850
  $item = LP_Global::course_item();
2851
 
2852
  if ( ( 'standard' !== ( $format = $item->get_format() ) ) && file_exists( $format_template = learn_press_locate_template( "content-lesson/{$format}/title.php" ) ) ) {
2853
- include_once $format_template;
2854
 
2855
  return;
2856
  }
@@ -2867,7 +2873,7 @@ if ( ! function_exists( 'learn_press_content_item_lesson_content' ) ) {
2867
  }
2868
 
2869
  if ( ( 'standard' !== ( $format = $item->get_format() ) ) && file_exists( $format_template = learn_press_locate_template( "content-lesson/{$format}/content.php" ) ) ) {
2870
- include_once $format_template;
2871
 
2872
  return;
2873
  }
@@ -2876,6 +2882,18 @@ if ( ! function_exists( 'learn_press_content_item_lesson_content' ) ) {
2876
  }
2877
  }
2878
 
 
 
 
 
 
 
 
 
 
 
 
 
2879
  if ( ! function_exists( 'learn_press_content_item_lesson_complete_button' ) ) {
2880
  function learn_press_content_item_lesson_complete_button() {
2881
  $user = LP_Global::user();
@@ -3020,6 +3038,10 @@ if ( ! function_exists( 'learn_press_content_item_nav' ) ) {
3020
  }
3021
  }
3022
 
 
 
 
 
3023
  if ( ! function_exists( 'learn_press_profile_mobile_menu' ) ) {
3024
  function learn_press_profile_mobile_menu() {
3025
  learn_press_get_template( 'profile/mobile-menu.php' );
216
  $user = learn_press_get_current_user();
217
 
218
  if ( ! $user->has_enrolled_course( $course->get_id() ) ) {
219
+ // Remove all other buttons
220
  learn_press_remove_course_buttons();
221
  learn_press_get_template( 'single-course/buttons/external-link.php' );
222
  // Add back other buttons for other courses
372
  if ( $profile->get_user()->is_guest() ) {
373
  return;
374
  }
375
+
376
  learn_press_get_template( 'profile/profile-cover.php', array( 'user' => $user ) );
377
  }
378
  }
514
  */
515
  function learn_press_course_item_content() {
516
  global $lp_course, $lp_course_item;
517
+
518
+ $item = LP_Global::course_item();
519
+
520
+ if ( $item->is_blocked() ) {
521
+ learn_press_get_template( 'global/block-content.php' );
522
+
523
+ return;
524
+ }
525
+
526
+ $item_template_name = learn_press_locate_template( 'single-course/content-item-' . $item->get_item_type() . '.php' );
527
 
528
  if ( file_exists( $item_template_name ) ) {
529
+ learn_press_get_template( 'single-course/content-item-' . $item->get_item_type() . '.php' );
530
  }
531
  }
532
  }
1574
  }
1575
  }
1576
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1577
  if ( ! function_exists( 'learn_press_course_buttons' ) ) {
1578
  /**
1579
  * Display course retake button
1962
  if ( $status = $user->get_item_status( $lesson_id ) ) {
1963
  $classes[] = "item-has-status item-{$status}";
1964
  }
1965
+ if ( $lesson_id && $course->is_current_item( $lesson_id ) ) {
1966
  $classes[] = 'item-current';
1967
  }
1968
  if ( learn_press_is_course() ) {
1975
  $classes[] = 'preview-item';
1976
  }
1977
 
1978
+ if ( $user->can_view_item( $lesson_id, $course_id ) ) {
1979
  $classes[] = 'viewable';
1980
  }
1981
 
2023
  $classes[] = "item-has-status item-{$status}";
2024
  }
2025
 
2026
+ if ( $quiz_id && $course->is_current_item( $quiz_id ) ) {
2027
  $classes[] = 'item-current';
2028
  }
2029
 
2030
+ if ( $user->can_view_item( $quiz_id, $course_id ) ) {
2031
  $classes[] = 'viewable';
2032
  }
2033
 
2141
  function learn_press_display_message( $message, $type = 'success' ) {
2142
 
2143
  // get all messages added into queue
2144
+ $messages = learn_press_session_get( learn_press_session_message_id() );
2145
+ learn_press_session_set( learn_press_session_message_id(), null );
2146
 
2147
  // add new notice and display
2148
  learn_press_add_message( $message, $type );
2149
  echo learn_press_get_messages( true );
2150
 
2151
  // store back messages
2152
+ learn_press_session_set( learn_press_session_message_id(), $messages );
2153
  }
2154
 
2155
  /**
2169
  /**
2170
  * Add new message into queue for displaying.
2171
  *
2172
+ * @param string $message
2173
+ * @param string $type
2174
+ * @param array $options
2175
+ * @param int|bool $current_user . @since 3.0.9 - add for current user only
2176
  */
2177
+ function learn_press_add_message( $message, $type = 'success', $options = array(), $current_user = true ) {
2178
 
2179
  if ( is_string( $options ) ) {
2180
  $options = array( 'id' => $options );
2187
  )
2188
  );
2189
 
2190
+ if ( $current_user ) {
2191
+ if ( true === $current_user ) {
2192
+ $current_user = get_current_user_id();
2193
+ }
2194
+ }
2195
+
2196
+ $key = "messages{$current_user}";
2197
+
2198
+ $messages = learn_press_session_get( $key );
2199
+
2200
  if ( empty( $messages[ $type ] ) ) {
2201
  $messages[ $type ] = array();
2202
  }
2203
+
2204
  $messages[ $type ][ $options['id'] ] = array( 'content' => $message, 'options' => $options );
2205
 
2206
+ learn_press_session_set( $key, $messages );
2207
  }
2208
 
2209
  function learn_press_get_message( $message, $type = 'success' ) {
2223
  * @param string|array $type
2224
  */
2225
  function learn_press_remove_message( $id = '', $type = '' ) {
2226
+ if ( ! $groups = learn_press_session_get( learn_press_session_message_id() ) ) {
2227
  return;
2228
  }
2229
 
2251
  $groups = array();
2252
  }
2253
 
2254
+ learn_press_session_set( learn_press_session_message_id(), $groups );
2255
  }
2256
 
2257
  /**
2260
  * @param bool
2261
  */
2262
  function learn_press_print_messages( $clear = true ) {
2263
+ $messages = learn_press_session_get( learn_press_session_message_id() );
2264
  learn_press_get_template( 'global/message.php', array( 'messages' => $messages ) );
2265
  if ( $clear ) {
2266
+ learn_press_session_set( learn_press_session_message_id(), array() );
2267
  }
2268
  }
2269
 
2270
  function learn_press_message_count( $type = '' ) {
2271
  $count = 0;
2272
+ $messages = learn_press_session_get( learn_press_session_message_id(), array() );
2273
 
2274
  if ( isset( $messages[ $type ] ) ) {
2275
  $count = absint( sizeof( $messages[ $type ] ) );
2282
  return $count;
2283
  }
2284
 
2285
+ function learn_press_session_message_id() {
2286
+ return "messages" . get_current_user_id();
2287
+ }
2288
+
2289
  function learn_press_clear_messages() {
2290
  _deprecated_function( __FUNCTION__, '3.0.0', 'learn_press_remove_message' );
2291
  learn_press_remove_message();
2331
  $quiz_status = LP()->user->get_quiz_status( get_the_ID() );
2332
  $redirect = false;
2333
  $error_message = false;
2334
+ if ( ! $user->can_view_quiz( $quiz->id ) ) {
2335
  if ( $course = $quiz->get_course() ) {
2336
  $redirect = $course->permalink;
2337
  $error_message = sprintf( __( 'Access denied "%s"', 'learnpress' ) );
2347
  $redirect = apply_filters( 'learn_press_quiz_access_denied_redirect_permalink', $redirect, $quiz_status, $quiz->id, $user->get_id() );
2348
  break;
2349
  case LP_COURSE_CPT:
2350
+ if ( ( $course = learn_press_get_course() ) && $item_id = $course->is_viewing_item() ) {
2351
+ if ( ! LP()->user->can_view_item( $item_id ) ) {
2352
  $redirect = apply_filters( 'learn_press_lesson_access_denied_redirect_permalink', $course->permalink, $item_id, $user->get_id() );
2353
  }
2354
  }
2627
  }
2628
  $user = learn_press_get_current_user();
2629
  // If user haven't got permission
2630
+ if ( ! current_user_can( 'edit-lp_quiz' ) && ! $user->can_view_quiz( $quiz->id ) ) {
2631
  switch ( LP()->settings->get( 'quiz_restrict_access' ) ) {
2632
  case 'custom':
2633
  $template = learn_press_locate_template( 'global/restrict-access.php' );
2856
  $item = LP_Global::course_item();
2857
 
2858
  if ( ( 'standard' !== ( $format = $item->get_format() ) ) && file_exists( $format_template = learn_press_locate_template( "content-lesson/{$format}/title.php" ) ) ) {
2859
+ include $format_template;
2860
 
2861
  return;
2862
  }
2873
  }
2874
 
2875
  if ( ( 'standard' !== ( $format = $item->get_format() ) ) && file_exists( $format_template = learn_press_locate_template( "content-lesson/{$format}/content.php" ) ) ) {
2876
+ include $format_template;
2877
 
2878
  return;
2879
  }
2882
  }
2883
  }
2884
 
2885
+ if ( ! function_exists( 'learn_press_content_item_lesson_content_blocked' ) ) {
2886
+ function learn_press_content_item_lesson_content_blocked() {
2887
+ $item = LP_Global::course_item();
2888
+
2889
+ if ( ! $item->is_blocked() ) {
2890
+ return;
2891
+ }
2892
+
2893
+ learn_press_get_template( 'global/block-content.php' );
2894
+ }
2895
+ }
2896
+
2897
  if ( ! function_exists( 'learn_press_content_item_lesson_complete_button' ) ) {
2898
  function learn_press_content_item_lesson_complete_button() {
2899
  $user = LP_Global::user();
3038
  }
3039
  }
3040
 
3041
+ function learn_press_disable_course_comment_form() {
3042
+ add_filter( 'comments_template', 'learn_press_blank_comments_template', 999 );
3043
+ }
3044
+
3045
  if ( ! function_exists( 'learn_press_profile_mobile_menu' ) ) {
3046
  function learn_press_profile_mobile_menu() {
3047
  learn_press_get_template( 'profile/mobile-menu.php' );
inc/lp-template-hooks.php CHANGED
@@ -184,21 +184,25 @@ add_action( 'learn-press/single-item-summary', 'learn_press_single_course_conten
184
  * @see learn_press_content_item_comments
185
  */
186
  add_action( 'learn-press/course-item-content', 'learn_press_course_item_content', 5 );
187
- add_action( 'learn-press/course-item-content', 'learn_press_content_item_comments', 10 );
188
 
189
  /**
190
  * @see learn_press_content_item_nav
 
191
  */
192
  add_action( 'learn-press/after-course-item-content', 'learn_press_content_item_nav', 5 );
193
  add_action( 'learn-press/after-course-item-content', 'learn_press_lesson_comment_form', 10 );
 
194
 
195
  /**
196
  * @see learn_press_content_item_lesson_title
197
  * @see learn_press_content_item_lesson_content
 
198
  * @see learn_press_content_item_lesson_complete_button
199
  */
200
  add_action( 'learn-press/before-content-item-summary/lp_lesson', 'learn_press_content_item_lesson_title', 10 );
201
  add_action( 'learn-press/content-item-summary/lp_lesson', 'learn_press_content_item_lesson_content', 10 );
 
202
  add_action( 'learn-press/after-content-item-summary/lp_lesson', 'learn_press_content_item_lesson_complete_button', 10 );
203
  add_action( 'learn-press/after-content-item-summary/lp_lesson', 'learn_press_course_finish_button', 15 );
204
 
184
  * @see learn_press_content_item_comments
185
  */
186
  add_action( 'learn-press/course-item-content', 'learn_press_course_item_content', 5 );
187
+ //add_action( 'learn-press/course-item-content', 'learn_press_content_item_comments', 10 );
188
 
189
  /**
190
  * @see learn_press_content_item_nav
191
+ * @see learn_press_disable_course_comment_form
192
  */
193
  add_action( 'learn-press/after-course-item-content', 'learn_press_content_item_nav', 5 );
194
  add_action( 'learn-press/after-course-item-content', 'learn_press_lesson_comment_form', 10 );
195
+ add_action( 'learn-press/after-course-item-content', 'learn_press_disable_course_comment_form', 1000 );
196
 
197
  /**
198
  * @see learn_press_content_item_lesson_title
199
  * @see learn_press_content_item_lesson_content
200
+ * @see learn_press_content_item_lesson_content_blocked
201
  * @see learn_press_content_item_lesson_complete_button
202
  */
203
  add_action( 'learn-press/before-content-item-summary/lp_lesson', 'learn_press_content_item_lesson_title', 10 );
204
  add_action( 'learn-press/content-item-summary/lp_lesson', 'learn_press_content_item_lesson_content', 10 );
205
+ add_action( 'learn-press/content-item-summary/lp_lesson', 'learn_press_content_item_lesson_content_blocked', 15 );
206
  add_action( 'learn-press/after-content-item-summary/lp_lesson', 'learn_press_content_item_lesson_complete_button', 10 );
207
  add_action( 'learn-press/after-content-item-summary/lp_lesson', 'learn_press_course_finish_button', 15 );
208
 
inc/order/lp-order-functions.php CHANGED
@@ -821,7 +821,7 @@ function _learn_press_checkout_auto_enroll_free_course( $result, $order_id ) {
821
  $user = learn_press_get_user( $order->user_id, true );
822
  if ( $order_items = $order->get_items() ) {
823
  foreach ( $order_items as $item ) {
824
- if ( $user->has( 'enrolled-course', $item['course_id'] ) ) {
825
  continue;
826
  }
827
  if ( $user->enroll( $item['course_id'] ) ) {
821
  $user = learn_press_get_user( $order->user_id, true );
822
  if ( $order_items = $order->get_items() ) {
823
  foreach ( $order_items as $item ) {
824
+ if ( $user->has_enrolled_course( $item['course_id'] ) ) {
825
  continue;
826
  }
827
  if ( $user->enroll( $item['course_id'] ) ) {
inc/question/class-lp-question-answers.php CHANGED
@@ -269,7 +269,7 @@ if ( ! class_exists( 'LP_Question_Answers' ) ) {
269
  // sanitize unwanted classes
270
  $classes = LP_Helper::sanitize_array( $classes );
271
 
272
- return apply_filters( 'learn-press/question/answer-option/classes', $classes, $this );
273
  }
274
 
275
  /**
@@ -388,16 +388,26 @@ if ( ! class_exists( 'LP_Question_Answer_Option' ) ) {
388
  }
389
 
390
  if ( $this->get_question()->show_correct_answers() === 'yes' ) {
391
- if ( $this->is_true() ) {
 
 
 
 
392
  $classes[] = 'answer-correct';
393
  }
394
- if ( $this->is_checked() && $this->is_true() ) {
 
 
 
 
 
395
  $classes[] = 'answered-correct';
396
- } elseif ( $this->is_checked() && ! $this->is_true() ) {
397
  $classes[] = 'answered-wrong';
398
- } elseif ( ! $this->is_checked() && $this->is_true() ) {
399
  $classes[] = 'answered-wrong';
400
  }
 
401
  }
402
 
403
  // sanitize unwanted classes
269
  // sanitize unwanted classes
270
  $classes = LP_Helper::sanitize_array( $classes );
271
 
272
+ return apply_filters( 'learn-press/question/answer-options/classes', $classes, $this );
273
  }
274
 
275
  /**
388
  }
389
 
390
  if ( $this->get_question()->show_correct_answers() === 'yes' ) {
391
+
392
+ $is_checked = $this->is_checked();
393
+ $is_true = $this->is_true();
394
+
395
+ if ( $is_true ) {
396
  $classes[] = 'answer-correct';
397
  }
398
+
399
+ if ( $is_checked ) {
400
+ $classes[] = 'answer-selected';
401
+ }
402
+
403
+ if ( $is_checked && $is_true ) {
404
  $classes[] = 'answered-correct';
405
+ } elseif ( $is_checked && ! $is_true ) {
406
  $classes[] = 'answered-wrong';
407
+ } elseif ( ! $is_checked && $is_true ) {
408
  $classes[] = 'answered-wrong';
409
  }
410
+
411
  }
412
 
413
  // sanitize unwanted classes
inc/question/class-lp-question-true-or-false.php CHANGED
@@ -46,14 +46,16 @@ if ( ! class_exists( 'LP_Question_True_Or_False ' ) ) {
46
  public function get_default_answers() {
47
  $answers = array(
48
  array(
49
- 'is_true' => 'yes',
50
- 'value' => 'true',
51
- 'text' => __( 'True', 'learnpress' )
 
52
  ),
53
  array(
54
- 'is_true' => 'no',
55
- 'value' => 'false',
56
- 'text' => __( 'False', 'learnpress' )
 
57
  )
58
  );
59
 
46
  public function get_default_answers() {
47
  $answers = array(
48
  array(
49
+ 'question_answer_id' => - 1,
50
+ 'is_true' => 'yes',
51
+ 'value' => 'true',
52
+ 'text' => __( 'True', 'learnpress' )
53
  ),
54
  array(
55
+ 'question_answer_id' => - 2,
56
+ 'is_true' => 'no',
57
+ 'value' => 'false',
58
+ 'text' => __( 'False', 'learnpress' )
59
  )
60
  );
61
 
inc/question/class-lp-question.php CHANGED
@@ -564,9 +564,10 @@ if ( ! class_exists( 'LP_Question' ) ) {
564
  */
565
  public static function get_default_answer() {
566
  $answer = array(
567
- 'text' => __( 'New Option', 'learnpress' ),
568
- 'is_true' => false,
569
- 'value' => learn_press_uniqid()
 
570
  );
571
 
572
  return $answer;
@@ -968,7 +969,7 @@ if ( ! class_exists( 'LP_Question' ) ) {
968
  $question_type = get_post_meta( $question_id, '_lp_type', true );
969
  }
970
 
971
- $class_name = self::get_class_name_from_question_type( $question_type );
972
 
973
  // Filter class name so that the class can be overridden if extended.
974
  return apply_filters( 'learn-press/question/object-class', $class_name, $question_type, $question_id );
@@ -982,6 +983,11 @@ if ( ! class_exists( 'LP_Question' ) ) {
982
  * @return string|false
983
  */
984
  public static function get_class_name_from_question_type( $question_type ) {
 
 
 
 
 
985
  return ! $question_type ? __CLASS__ : 'LP_Question_' . implode( '_', array_map( 'ucfirst', explode( '-', $question_type ) ) );
986
  }
987
 
564
  */
565
  public static function get_default_answer() {
566
  $answer = array(
567
+ 'question_answer_id' => - 1,
568
+ 'text' => __( 'New Option', 'learnpress' ),
569
+ 'is_true' => false,
570
+ 'value' => learn_press_uniqid()
571
  );
572
 
573
  return $answer;
969
  $question_type = get_post_meta( $question_id, '_lp_type', true );
970
  }
971
 
972
+ $class_name = self::get_class_name_from_question_type( array( $question_type ) );
973
 
974
  // Filter class name so that the class can be overridden if extended.
975
  return apply_filters( 'learn-press/question/object-class', $class_name, $question_type, $question_id );
983
  * @return string|false
984
  */
985
  public static function get_class_name_from_question_type( $question_type ) {
986
+
987
+ if ( is_array( $question_type ) ) {
988
+ $question_type = reset( $question_type );
989
+ }
990
+
991
  return ! $question_type ? __CLASS__ : 'LP_Question_' . implode( '_', array_map( 'ucfirst', explode( '-', $question_type ) ) );
992
  }
993
 
inc/quiz/class-lp-quiz-factory.php CHANGED
@@ -471,18 +471,38 @@ if ( ! class_exists( 'LP_Quiz_Factory' ) ) {
471
  throw new Exception( __( 'Something went wrong!', 'learnpress' ), LP_INVALID_REQUEST );
472
  }
473
 
474
- if ( $questions = self::get_answers_posted() ) {
475
- $user = learn_press_get_current_user();
476
- $course = learn_press_get_course( LP_Request::get_int( 'course-id' ) );
477
- $quiz = learn_press_get_quiz( LP_Request::get_int( 'quiz-id' ) );
478
 
479
- $course_data = $user->get_course_data( $course->get_id() );
480
- $quiz_data = $course_data->get_item_quiz( $quiz->get_id() );
 
481
 
482
- $quiz_data->add_question_answer( $questions );
483
- $quiz_data->update();
484
  }
485
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
 
487
  }
488
  catch ( Exception $ex ) {
471
  throw new Exception( __( 'Something went wrong!', 'learnpress' ), LP_INVALID_REQUEST );
472
  }
473
 
474
+ $nav_type = LP_Request::get_string( 'nav-type' );
 
 
 
475
 
476
+ $course_id = LP_Request::get_int( 'course-id' );
477
+ $quiz_id = LP_Request::get_int( 'quiz-id' );
478
+ $question_id = LP_Request::get_int( 'question-id' );
479
 
480
+ if ( ! $questions = self::get_answers_posted() ) {
481
+ $questions = array();
482
  }
483
 
484
+ $user = learn_press_get_current_user();
485
+ $course = learn_press_get_course( $course_id );
486
+ $quiz = learn_press_get_quiz( $quiz_id );
487
+
488
+ $course_data = $user->get_course_data( $course->get_id() );
489
+ $quiz_data = $course_data->get_item_quiz( $quiz->get_id() );
490
+
491
+ // If user click 'Skip' button
492
+ if ( $nav_type === 'skip-question' ) {
493
+ if ( $quiz_data->get_question_answer( $question_id ) == '' ) {
494
+ $questions[ $question_id ] = '__SKIPPED__';
495
+ } else {
496
+ unset( $questions[ $question_id ] );
497
+ }
498
+ } else {
499
+ if ( ! array_key_exists( $question_id, $questions ) ) {
500
+ $questions[ $question_id ] = array();
501
+ }
502
+ }
503
+
504
+ $quiz_data->add_question_answer( $questions );
505
+ $quiz_data->update();
506
 
507
  }
508
  catch ( Exception $ex ) {
inc/quiz/class-lp-quiz.php CHANGED
@@ -386,7 +386,7 @@ if ( ! class_exists( 'LP_Quiz' ) ) {
386
  }
387
 
388
  $post = get_post( $id );
389
- $result[] = array(
390
  'id' => $id,
391
  'open' => false,
392
  'title' => $post->post_title,
@@ -394,7 +394,7 @@ if ( ! class_exists( 'LP_Quiz' ) ) {
394
  'key' => $question->get_type(),
395
  'label' => $question->get_type_label()
396
  ),
397
- 'answers' => $answers,
398
  'settings' => array(
399
  'content' => $post->post_content,
400
  'mark' => get_post_meta( $id, '_lp_mark', true ),
@@ -402,7 +402,7 @@ if ( ! class_exists( 'LP_Quiz' ) ) {
402
  'hint' => get_post_meta( $id, '_lp_hint', true )
403
  ),
404
  'order' => $question_order[ $index ]
405
- );
406
  }
407
  }
408
 
@@ -506,6 +506,8 @@ if ( ! class_exists( 'LP_Quiz' ) ) {
506
  * @throws Exception
507
  */
508
  public function has( $feature ) {
 
 
509
  $args = func_get_args();
510
  unset( $args[0] );
511
  $method = 'has_' . preg_replace( '!-!', '_', $feature );
@@ -674,8 +676,9 @@ if ( ! class_exists( 'LP_Quiz' ) ) {
674
  $user_id = learn_press_get_current_user_id();
675
  }
676
  $user = learn_press_get_user( $user_id );
677
- if ( $user && $results = $user->get_quiz_results( $this->get_id() ) ) {
678
  $questions = (array) $results->questions;
 
679
  } else {
680
  $questions = (array) $this->get_questions();
681
  $questions = array_keys( $questions );
@@ -699,12 +702,14 @@ if ( ! class_exists( 'LP_Quiz' ) ) {
699
  }
700
 
701
  /**
702
- * @return LP_Question
 
 
703
  */
704
- public function get_viewing_question() {
705
  global $lp_quiz_question;
706
 
707
- return $lp_quiz_question;
708
  }
709
 
710
  /**
@@ -817,6 +822,37 @@ if ( ! class_exists( 'LP_Quiz' ) ) {
817
  return 'yes' === $this->get_data( 'show_hide_question' );
818
  }
819
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
820
  /**
821
  * Implement ArrayAccess functions.
822
  *
386
  }
387
 
388
  $post = get_post( $id );
389
+ $result[] = apply_filters( 'learn-press/quiz-editor/question-data', array(
390
  'id' => $id,
391
  'open' => false,
392
  'title' => $post->post_title,
394
  'key' => $question->get_type(),
395
  'label' => $question->get_type_label()
396
  ),
397
+ 'answers' => apply_filters( 'learn-press/quiz-editor/question-answers-data', $answers, $id, $this->get_id() ),
398
  'settings' => array(
399
  'content' => $post->post_content,
400
  'mark' => get_post_meta( $id, '_lp_mark', true ),
402
  'hint' => get_post_meta( $id, '_lp_hint', true )
403
  ),
404
  'order' => $question_order[ $index ]
405
+ ), $id, $this->get_id() );
406
  }
407
  }
408
 
506
  * @throws Exception
507
  */
508
  public function has( $feature ) {
509
+ _deprecated_function( __FUNCTION__, '3.0.8' );
510
+
511
  $args = func_get_args();
512
  unset( $args[0] );
513
  $method = 'has_' . preg_replace( '!-!', '_', $feature );
676
  $user_id = learn_press_get_current_user_id();
677
  }
678
  $user = learn_press_get_user( $user_id );
679
+ if ( $user && ( $results = $user->get_quiz_results( $this->get_id(), '', '' ) ) ) {
680
  $questions = (array) $results->questions;
681
+
682
  } else {
683
  $questions = (array) $this->get_questions();
684
  $questions = array_keys( $questions );
702
  }
703
 
704
  /**
705
+ * @param string $return
706
+ *
707
+ * @return LP_Question|int
708
  */
709
+ public function get_viewing_question( $return = '' ) {
710
  global $lp_quiz_question;
711
 
712
+ return $return !== 'id' ? $lp_quiz_question : ( $lp_quiz_question ? $lp_quiz_question->get_id() : 0 );
713
  }
714
 
715
  /**
822
  return 'yes' === $this->get_data( 'show_hide_question' );
823
  }
824
 
825
+ /**
826
+ * Get css classes of question displays in a list.
827
+ *
828
+ * @param int $question_id
829
+ * @param null $position
830
+ *
831
+ * @return array
832
+ */
833
+ public function get_question_number_class( $question_id, $position = null ) {
834
+
835
+ if ( null === $position ) {
836
+ $position = $this->get_question_index( $question_id );
837
+ }
838
+
839
+ $class = array( "question-" . $position );
840
+
841
+ if ( $this->is_viewing_question( $question_id ) ) {
842
+ $class[] = 'current';
843
+ }
844
+
845
+ $user = learn_press_get_current_user();
846
+
847
+ if ( $quiz_data = $user->get_quiz_data( $this->get_id() ) ) {
848
+ if ( $quiz_data->is_skipped( $question_id ) ) {
849
+ $class[] = 'skipped';
850
+ }
851
+ }
852
+
853
+ return $class;
854
+ }
855
+
856
  /**
857
  * Implement ArrayAccess functions.
858
  *
inc/quiz/lp-quiz-functions.php CHANGED
@@ -54,7 +54,7 @@ function learn_press_get_question_answer_meta( $item_id, $meta_key, $single = tr
54
  *
55
  * @author TuNN
56
  *
57
- * @param int $quiz_id The ID of a quiz to get all questions
58
  * @param boolean $only_ids return an array of questions with IDs only or as post objects
59
  *
60
  * @return array|null
@@ -257,7 +257,7 @@ function learn_press_get_user_question_url( $quiz_id, $current_question_id = 0,
257
  function learn_press_user_has_started_quiz( $user_id = null, $quiz_id = null ) {
258
  $user = $user_id ? learn_press_get_user( $user_id ) : learn_press_get_current_user();
259
 
260
- return $user ? $user->has( 'started-quiz', $quiz_id ) : false;
261
  }
262
 
263
  /**
@@ -278,23 +278,16 @@ function learn_press_get_user_quiz_status( $quiz_id, $user_id = false ) {
278
  return $user ? $user->get_quiz_status( $quiz_id ) : '';
279
  }
280
 
281
-
282
- //add_action( 'template_redirect', 'learn_press_redirect_to_question' );
283
-
284
-
285
  function learn_press_get_quizzes( $user_id = 0, &$args = array() ) {
286
- if ( ! $user_id ) {
287
- $user_id = learn_press_get_current_user_id();
288
- }
289
- if ( ! $user_id ) {
290
- return;
291
- }
292
- $user = learn_press_get_user( $user_id );
293
-
294
- return $user->get_quizzes( $args );
295
  }
296
 
297
-
 
 
 
 
 
298
  function learn_press_add_question_type_support( $types, $supports ) {
299
  if ( empty( $GLOBALS['learn_press_question_type_support'] ) ) {
300
  $GLOBALS['learn_press_question_type_support'] = array();
@@ -325,6 +318,11 @@ function learn_press_add_question_type_support( $types, $supports ) {
325
  $GLOBALS['learn_press_question_type_support'] = $_supports;
326
  }
327
 
 
 
 
 
 
328
  function learn_press_get_question_type_support( $type = '' ) {
329
  $supports = ! empty( $GLOBALS['learn_press_question_type_support'] ) ? $GLOBALS['learn_press_question_type_support'] : array();
330
 
@@ -340,6 +338,10 @@ function learn_press_get_question_type_support( $type = '' ) {
340
  */
341
  function learn_press_is_support_question_type( $type ) {
342
 
 
 
 
 
343
  $supports = learn_press_get_question_type_support();
344
 
345
  // New type is supported?
@@ -429,7 +431,7 @@ if ( ! function_exists( 'learn_press_quiz_get_questions_order' ) ) {
429
 
430
  function learn_press_is_review_questions() {
431
  if ( ( $item = LP_Global::course_item() ) && ( $user = learn_press_get_current_user() ) ) {
432
- $quiz_data = $user->get_item_data( $item->get_id(), LP_Global::course('id') );
433
 
434
  return $quiz_data && $quiz_data->is_review_questions();
435
  }
54
  *
55
  * @author TuNN
56
  *
57
+ * @param int $quiz_id The ID of a quiz to get all questions
58
  * @param boolean $only_ids return an array of questions with IDs only or as post objects
59
  *
60
  * @return array|null
257
  function learn_press_user_has_started_quiz( $user_id = null, $quiz_id = null ) {
258
  $user = $user_id ? learn_press_get_user( $user_id ) : learn_press_get_current_user();
259
 
260
+ return $user ? $user->has_started_quiz( $quiz_id ) : false;
261
  }
262
 
263
  /**
278
  return $user ? $user->get_quiz_status( $quiz_id ) : '';
279
  }
280
 
 
 
 
 
281
  function learn_press_get_quizzes( $user_id = 0, &$args = array() ) {
282
+ // TODO: get all quizzes by user
 
 
 
 
 
 
 
 
283
  }
284
 
285
+ /**
286
+ * Add new type that LP question can support
287
+ *
288
+ * @param string|array $types
289
+ * @param string|array $supports
290
+ */
291
  function learn_press_add_question_type_support( $types, $supports ) {
292
  if ( empty( $GLOBALS['learn_press_question_type_support'] ) ) {
293
  $GLOBALS['learn_press_question_type_support'] = array();
318
  $GLOBALS['learn_press_question_type_support'] = $_supports;
319
  }
320
 
321
+ /**
322
+ * @param string $type
323
+ *
324
+ * @return array|mixed
325
+ */
326
  function learn_press_get_question_type_support( $type = '' ) {
327
  $supports = ! empty( $GLOBALS['learn_press_question_type_support'] ) ? $GLOBALS['learn_press_question_type_support'] : array();
328
 
338
  */
339
  function learn_press_is_support_question_type( $type ) {
340
 
341
+ if ( is_array( $type ) ) {
342
+ $type = reset( $type );
343
+ }
344
+
345
  $supports = learn_press_get_question_type_support();
346
 
347
  // New type is supported?
431
 
432
  function learn_press_is_review_questions() {
433
  if ( ( $item = LP_Global::course_item() ) && ( $user = learn_press_get_current_user() ) ) {
434
+ $quiz_data = $user->get_item_data( $item->get_id(), LP_Global::course( 'id' ) );
435
 
436
  return $quiz_data && $quiz_data->is_review_questions();
437
  }
inc/updates/learnpress-update-3.0.0.php CHANGED
@@ -3,69 +3,253 @@
3
  * Todo: update emails
4
  */
5
 
 
6
 
7
  /**
8
  * Class LP_Update_30
9
  *
10
  * Helper class for updating database to 3.0.0
11
  */
12
- class LP_Update_30 {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  /**
15
- * Entry point
 
 
 
 
16
  */
17
- public static function update() {
 
 
18
  LP_Debug::startTransaction();
19
- try {
20
- self::add_column_user_items();
21
- self::upgrade_orders();
22
- self::update_user_course_items();
23
- self::update_option_no_require_enroll();
24
- self::update_post_meta();
25
- self::update_settings();
26
-
27
- LP_Install::update_db_version();
28
- LP_Install::update_version();
29
-
30
- set_transient( 'lp_upgraded_30', 'yes', DAY_IN_SECONDS );
31
- LP_Debug::commitTransaction();
32
- }
33
- catch ( Exception $exception ) {
34
- LP_Debug::rollbackTransaction();
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
37
 
38
- protected static function update_settings() {
 
 
 
 
 
 
 
 
 
39
  global $wpdb;
40
  $query = $wpdb->prepare( "
41
- SELECT *
42
- FROM {$wpdb->options}
43
- WHERE option_name LIKE %s
44
- ", $wpdb->esc_like( 'learn_press' ) . '%' );
 
 
 
45
 
46
- $settings_defaults = array();
47
- if ( $rows = $wpdb->get_results( $query ) ) {
48
- foreach ( $rows as $row ) {
49
- $settings_defaults[ $row->option_name ] = $row->option_value;
50
- }
51
  }
52
 
53
- $new_options = array(
54
- 'learn_press_profile_avatar' => 'yes',
55
- 'learn_press_profile_publicity' => array( 'dashboard' => 'yes' )
56
- );
57
 
58
- foreach ( $new_options as $k => $v ) {
59
- if ( ! array_key_exists( $k, $settings_defaults ) ) {
60
- update_option( $k, $v, 'yes' );
 
 
 
 
 
 
 
61
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
64
 
65
  /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  * Update/Convert post meta
67
  */
68
- protected static function update_post_meta() {
 
 
69
  global $wpdb;
70
 
71
  // Update quiz meta _lp_review_questions = 'yes' if both _lp_show_hide_question = 'yes' and _lp_show_result = 'yes'
@@ -124,75 +308,42 @@ class LP_Update_30 {
124
  }
125
  }
126
  }
127
- }
128
 
129
- public static function update_option_no_require_enroll() {
130
- global $wpdb;
131
-
132
- $query = $wpdb->prepare( "
133
- SELECT *
134
- FROM {$wpdb->postmeta}
135
- WHERE meta_key = %s
136
- ",
137
- '_lp_required_enroll' );
138
-
139
- $metas = $wpdb->get_results( $query );
140
  }
141
 
142
- public static function upgrade_orders() {
 
 
 
 
 
143
  global $wpdb;
144
  $query = $wpdb->prepare( "
145
- SELECT p.ID
146
- FROM {$wpdb->posts} p
147
- INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id AND pm.meta_key = %s
148
- INNER JOIN {$wpdb->postmeta} pm2 ON p.ID = pm2.post_id AND pm2.meta_key = %s AND pm2.meta_value <> %s
149
- WHERE p.post_type = %s AND p.post_parent = 0
150
- LIMIT 0, 100
151
- ", '_lp_multi_users', '_order_version', '3.0.0', LP_ORDER_CPT );
152
-
153
- if ( ! $parent_orders = $wpdb->get_col( $query ) ) {
154
- return false;
155
- }
156
-
157
- foreach ( $parent_orders as $parent_id ) {
158
-
159
- if ( ! $parent_order = learn_press_get_order( $parent_id ) ) {
160
- continue;
161
- }
162
 
163
- if ( $child_orders = self::get_child_orders( $parent_id ) ) {
164
- continue;
 
 
165
  }
 
166
 
167
- if ( ! $order_users = $parent_order->get_users() ) {
168
- continue;
169
- }
170
- if ( ! $child_orders = self::_create_child_orders( $parent_order, $order_users ) ) {
171
- continue;
172
- }
173
 
174
- foreach ( $child_orders as $uid => $child_order ) {
175
- $wpdb->update(
176
- $wpdb->learnpress_user_items,
177
- array(
178
- 'ref_id' => $child_order->get_id()
179
- ),
180
- array(
181
- 'user_id' => $uid,
182
- 'ref_id' => $parent_id
183
- ),
184
- array( '%d' ),
185
- array( '%d', '%d' )
186
- );
187
  }
188
-
189
- delete_post_meta( $parent_id, '_user_id' );
190
- update_post_meta( $parent_id, '_user_id', $order_users );
191
- update_post_meta( $parent_id, '_order_version', '3.0.0' );
192
-
193
  }
194
 
195
- return true;
196
  }
197
 
198
  /**
@@ -201,7 +352,7 @@ class LP_Update_30 {
201
  *
202
  * @return array
203
  */
204
- protected static function _create_child_orders( $order, $user_ids ) {
205
  $new_orders = array();
206
  if ( $child_orders = $order->get_child_orders( true ) ) {
207
  foreach ( $child_orders as $child_id ) {
@@ -235,7 +386,7 @@ class LP_Update_30 {
235
  return $new_orders;
236
  }
237
 
238
- public static function get_child_orders( $parent_id ) {
239
  global $wpdb;
240
  $order = new LP_Order( $parent_id );
241
  LP_Debug::instance()->add( $order->get_child_orders(), false, false, true );
@@ -243,98 +394,6 @@ class LP_Update_30 {
243
  return $order->get_child_orders();
244
  }
245
 
246
- /**
247
- * Add columns for storing the time in GMT
248
- * @since 3.0.0
249
- */
250
- public static function add_column_user_items() {
251
- global $wpdb;
252
- ob_start();
253
-
254
- // Add columns start_time_gmt, end_time_gmt
255
- $sql = $wpdb->prepare( "
256
- ALTER TABLE {$wpdb->learnpress_user_items}
257
- ADD COLUMN `start_time_gmt` DATETIME NULL DEFAULT %s AFTER `start_time`,
258
- ADD COLUMN `end_time_gmt` DATETIME NULL DEFAULT %s AFTER `end_time`;
259
- ", '0000-00-00 00:00:00', '0000-00-00 00:00:00' );
260
- @$wpdb->query( $sql );
261
-
262
- // Update start_time_gmt, end_time_gmt with offset time from start_time, end_time
263
- $time = new LP_Datetime();
264
- $offset = $time->getOffset( true );
265
- $null_time = LP_Datetime::getSqlNullDate();
266
-
267
- $sql = $wpdb->prepare( "
268
- UPDATE {$wpdb->learnpress_user_items}
269
- SET
270
- start_time_gmt = IF(start_time = %s, %s, DATE_ADD(start_time, INTERVAL %f HOUR)),
271
- end_time_gmt = IF(end_time = %s, %s, DATE_ADD(end_time, INTERVAL %f HOUR))
272
- ", $null_time, $null_time, $offset, $null_time, $null_time, $offset );
273
- @$wpdb->query( $sql );
274
-
275
- $sql = $wpdb->prepare( "
276
- ALTER TABLE {$wpdb->learnpress_user_items}
277
- CHANGE COLUMN `user_id` `user_id` BIGINT(20) NOT NULL DEFAULT %d ,
278
- CHANGE COLUMN `item_id` `item_id` BIGINT(20) NOT NULL DEFAULT %d ;
279
- ", - 1, - 1 );
280
- @$wpdb->query( $sql );
281
-
282
- ob_get_clean();
283
- }
284
-
285
- public static function update_user_course_items() {
286
- global $wpdb;
287
-
288
- // Get all courses in user items
289
- $item_courses = self::_get_item_courses();
290
- if ( ! $item_courses ) {
291
- return;
292
- }
293
-
294
- if ( ! $current_item_courses = self::_get_current_item_courses( $item_courses ) ) {
295
- return;
296
- }
297
-
298
- /**
299
- * Execute 10 courses
300
- */
301
- while ( $course_ids = array_splice( $item_courses, 0, 10 ) ) {
302
-
303
- // Delete existed retaken count to preventing duplication meta
304
- $query_args = $course_ids;
305
- $format = array_fill( 0, sizeof( $course_ids ), '%d' );
306
- $query_args[] = LP_COURSE_CPT;
307
- $query_args[] = '_lp_retaken_count';
308
-
309
- $query = $wpdb->prepare( "
310
- DELETE FROM {$wpdb->learnpress_user_itemmeta}
311
- WHERE learnpress_user_item_id IN (
312
- SELECT MAX(user_item_id)
313
- FROM {$wpdb->learnpress_user_items}
314
- WHERE item_id IN(" . join( ',', $format ) . ")
315
- AND item_type = %s
316
- GROUP BY user_id, item_id
317
- )
318
- AND meta_key = %s;
319
- ", $query_args );
320
- $wpdb->query( $query );
321
-
322
- /**
323
- * Re-Calculate number of retaken count and update again.
324
- */
325
- $query_args = array( '_lp_retaken_count', LP_COURSE_CPT );
326
- $query_args = array_merge( $query_args, $course_ids );
327
- $query = $wpdb->prepare( "
328
- INSERT INTO {$wpdb->learnpress_user_itemmeta}( `learnpress_user_item_id`, `meta_key`, `meta_value` )
329
- SELECT MAX( user_item_id ), %s, COUNT(*) - 1
330
- FROM {$wpdb->learnpress_user_items}
331
- WHERE item_type = %s
332
- AND item_id IN(" . join( ',', $format ) . ")
333
- GROUP BY user_id, item_id
334
- ", $query_args );
335
- $wpdb->query( $query );
336
- }
337
- }
338
 
339
  /**
340
  * Get user course items from learnpress_user_items.
@@ -343,7 +402,7 @@ class LP_Update_30 {
343
  *
344
  * @return array
345
  */
346
- protected static function _get_current_item_courses( $course_ids ) {
347
  global $wpdb;
348
  $query_args = $course_ids;
349
  $format = array_fill( 0, sizeof( $query_args ), '%d' );
@@ -363,21 +422,58 @@ class LP_Update_30 {
363
  return $wpdb->get_results( $query );
364
  }
365
 
366
- protected static function _get_item_courses() {
367
  global $wpdb;
368
- $query = $wpdb->prepare( "
369
- SELECT DISTINCT item_id
370
- FROM {$wpdb->learnpress_user_items}
371
- WHERE item_type = %s AND parent_id = 0
372
- ", LP_COURSE_CPT );
373
 
374
- return $wpdb->get_col( $query );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
  }
376
 
377
- public static function update_users() {
378
  // create table _learnpress_users
379
  // insert new row
380
  }
381
  }
382
 
383
- LP_Update_30::update();
3
  * Todo: update emails
4
  */
5
 
6
+ include_once dirname( __FILE__ ) . '/learnpress-update-base.php';
7
 
8
  /**
9
  * Class LP_Update_30
10
  *
11
  * Helper class for updating database to 3.0.0
12
  */
13
+ class LP_Update_30 extends LP_Update_Base {
14
+
15
+ public function __construct() {
16
+ $this->version = '3.0.0';
17
+ $this->steps = array(
18
+ 'add_column_user_items',
19
+ 'upgrade_orders',
20
+ 'update_user_course_items',
21
+ 'update_option_no_require_enroll',
22
+ 'update_post_meta',
23
+ 'update_settings'
24
+ );
25
+
26
+ parent::__construct();
27
+ }
28
 
29
  /**
30
+ * ========== STEP #1 ==========
31
+ *
32
+ * Add columns for storing the time in GMT.
33
+ *
34
+ * @since 3.0.0
35
  */
36
+ public function add_column_user_items() {
37
+ global $wpdb;
38
+
39
  LP_Debug::startTransaction();
40
+ ob_start();
41
+
42
+ // Add columns start_time_gmt, end_time_gmt
43
+ echo $sql = $wpdb->prepare( "
44
+ ALTER TABLE {$wpdb->learnpress_user_items}
45
+ ADD COLUMN `start_time_gmt` DATETIME NULL DEFAULT %s AFTER `start_time`,
46
+ ADD COLUMN `end_time_gmt` DATETIME NULL DEFAULT %s AFTER `end_time`;
47
+ ", '0000-00-00 00:00:00', '0000-00-00 00:00:00' );
48
+ @$wpdb->query( $sql );
49
+
50
+ // Update start_time_gmt, end_time_gmt with offset time from start_time, end_time
51
+ $time = new LP_Datetime();
52
+ $offset = $time->getOffset( true );
53
+ $null_time = LP_Datetime::getSqlNullDate();
54
+
55
+ // $query = $wpdb->prepare("
56
+ // select user_item_id
57
+ // from wp_learnpress_user_items
58
+ // where start_time <> '0000:00:00 00:00:00'
59
+ // AND start_time_gmt = '' OR start_time_gmt = '0000:00:00 00:00:00'
60
+ // LIMIT 0, 100");
61
+
62
+ echo $sql = $wpdb->prepare( "
63
+ UPDATE {$wpdb->learnpress_user_items}
64
+ SET
65
+ start_time_gmt = IF(start_time = %s, %s, DATE_ADD(start_time, INTERVAL %f HOUR)),
66
+ end_time_gmt = IF(end_time = %s, %s, DATE_ADD(end_time, INTERVAL %f HOUR))
67
+ ", $null_time, $null_time, $offset, $null_time, $null_time, $offset );
68
+ @$wpdb->query( $sql );
69
+
70
+ echo $sql = $wpdb->prepare( "
71
+ ALTER TABLE {$wpdb->learnpress_user_items}
72
+ CHANGE COLUMN `user_id` `user_id` BIGINT(20) NOT NULL DEFAULT %d ,
73
+ CHANGE COLUMN `item_id` `item_id` BIGINT(20) NOT NULL DEFAULT %d ;
74
+ ", - 1, - 1 );
75
+ @$wpdb->query( $sql );
76
+ $log = ob_get_clean();
77
+ LP_Debug::rollbackTransaction();
78
+
79
+ $this->_next_step();
80
+ LP_Debug::instance()->add( $log, 'lp-updater', false, true );
81
  }
82
 
83
+ /**
84
+ * ========== STEP #2 ==========
85
+ *
86
+ * Upgrade multi users orders
87
+ *
88
+ * @return bool
89
+ */
90
+ public function upgrade_orders() {
91
+ LP_Debug::instance()->add( __FUNCTION__, 'lp-updater-300', false, true );
92
+
93
  global $wpdb;
94
  $query = $wpdb->prepare( "
95
+ SELECT p.ID
96
+ FROM {$wpdb->posts} p
97
+ INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id AND pm.meta_key = %s
98
+ INNER JOIN {$wpdb->postmeta} pm2 ON p.ID = pm2.post_id AND pm2.meta_key = %s AND pm2.meta_value <> %s
99
+ WHERE p.post_type = %s AND p.post_parent = 0
100
+ LIMIT 0, 20
101
+ ", '_lp_multi_users', '_order_version', '3.0.0', LP_ORDER_CPT );
102
 
103
+ if ( ! $parent_orders = $wpdb->get_col( $query ) ) {
104
+ return $this->_next_step();
 
 
 
105
  }
106
 
107
+ foreach ( $parent_orders as $parent_id ) {
108
+ update_post_meta( $parent_id, '_order_version', '3.0.0' );
 
 
109
 
110
+ if ( ! $parent_order = learn_press_get_order( $parent_id ) ) {
111
+ continue;
112
+ }
113
+
114
+ if ( $child_orders = $this->get_child_orders( $parent_id ) ) {
115
+ continue;
116
+ }
117
+
118
+ if ( ! $order_users = $parent_order->get_users() ) {
119
+ continue;
120
  }
121
+ if ( ! $child_orders = $this->_create_child_orders( $parent_order, $order_users ) ) {
122
+ continue;
123
+ }
124
+
125
+ foreach ( $child_orders as $uid => $child_order ) {
126
+ $wpdb->update(
127
+ $wpdb->learnpress_user_items,
128
+ array(
129
+ 'ref_id' => $child_order->get_id()
130
+ ),
131
+ array(
132
+ 'user_id' => $uid,
133
+ 'ref_id' => $parent_id
134
+ ),
135
+ array( '%d' ),
136
+ array( '%d', '%d' )
137
+ );
138
+ }
139
+
140
+ delete_post_meta( $parent_id, '_user_id' );
141
+ update_post_meta( $parent_id, '_user_id', $order_users );
142
+
143
  }
144
+
145
+ return false;
146
+ }
147
+
148
+ /**
149
+ * ========== STEP #3 ==========
150
+ *
151
+ * Upgrade user course items
152
+ */
153
+ public function update_user_course_items() {
154
+ LP_Debug::instance()->add( __FUNCTION__, 'lp-updater-300', false, true );
155
+
156
+ return $this->_next_step();
157
+ // Get all courses in user items
158
+ $item_courses = $this->_get_item_courses( $this->get_min_user_item_id() );
159
+
160
+ if ( ! $item_courses ) {
161
+ return $this->_next_step();
162
+ }
163
+
164
+ $item_course_ids = wp_list_pluck( $item_courses, 'item_id' );
165
+ $item_course_ids = array_unique( $item_course_ids );
166
+
167
+ if ( ! $current_item_courses = $this->_get_current_item_courses( $item_course_ids ) ) {
168
+ //return $this->_next_step();
169
+ }
170
+
171
+ global $wpdb;
172
+
173
+ /**
174
+ * Execute 10 courses
175
+ */
176
+ //while ( $course_ids = array_splice( $item_courses, 0, 10 ) ) {
177
+
178
+ // Delete existed retaken count to preventing duplication meta
179
+ $query_args = $item_course_ids;
180
+ $format = array_fill( 0, sizeof( $item_course_ids ), '%d' );
181
+ $query_args[] = LP_COURSE_CPT;
182
+ $query_args[] = '_lp_retaken_count';
183
+
184
+ $query = $wpdb->prepare( "
185
+ DELETE FROM {$wpdb->learnpress_user_itemmeta}
186
+ WHERE learnpress_user_item_id IN (
187
+ SELECT MAX(user_item_id)
188
+ FROM {$wpdb->learnpress_user_items}
189
+ WHERE item_id IN(" . join( ',', $format ) . ")
190
+ AND item_type = %s
191
+ GROUP BY user_id, item_id
192
+ )
193
+ AND meta_key = %s;
194
+ ", $query_args );
195
+ $wpdb->query( $query );
196
+
197
+ /**
198
+ * Re-Calculate number of retaken count and update again.
199
+ */
200
+ $query_args = array( '_lp_retaken_count', LP_COURSE_CPT );
201
+ $query_args = array_merge( $query_args, $item_course_ids );
202
+ $query = $wpdb->prepare( "
203
+ INSERT INTO {$wpdb->learnpress_user_itemmeta}( `learnpress_user_item_id`, `meta_key`, `meta_value` )
204
+ SELECT MAX( user_item_id ), %s, COUNT(*) - 1
205
+ FROM {$wpdb->learnpress_user_items}
206
+ WHERE item_type = %s
207
+ AND item_id IN(" . join( ',', $format ) . ")
208
+ GROUP BY user_id, item_id
209
+ ", $query_args );
210
+ $wpdb->query( $query );
211
+
212
+ $user_item_ids = wp_list_pluck( $item_courses, 'user_item_id' );
213
+
214
+ // foreach ( $user_item_ids as $user_item_id ) {
215
+ // learn_press_update_user_item_meta( $user_item_id, 'upgrade', 'yes' );
216
+ // }
217
+
218
+ $min_user_item_id = end( $user_item_ids ) + 1;
219
+ update_option( 'lp_update_min_user_item_id', $min_user_item_id );
220
+
221
+ //}
222
+
223
+ return false;
224
  }
225
 
226
  /**
227
+ * ========== STEP #4 ==========
228
+ *
229
+ * Upgrade no-require-enroll option
230
+ */
231
+ public function update_option_no_require_enroll() {
232
+ global $wpdb;
233
+ LP_Debug::instance()->add( __FUNCTION__, 'lp-updater-300', false, true );
234
+
235
+ $query = $wpdb->prepare( "
236
+ SELECT *
237
+ FROM {$wpdb->postmeta}
238
+ WHERE meta_key = %s
239
+ ", '_lp_required_enroll' );
240
+
241
+ $metas = $wpdb->get_results( $query );
242
+
243
+ return $this->_next_step();
244
+ }
245
+
246
+ /**
247
+ * ========== STEP #5 ==========
248
  * Update/Convert post meta
249
  */
250
+ public function update_post_meta() {
251
+ LP_Debug::instance()->add( __FUNCTION__, 'lp-updater-300', false, true );
252
+
253
  global $wpdb;
254
 
255
  // Update quiz meta _lp_review_questions = 'yes' if both _lp_show_hide_question = 'yes' and _lp_show_result = 'yes'
308
  }
309
  }
310
  }
 
311
 
312
+ return $this->_next_step();
 
 
 
 
 
 
 
 
 
 
313
  }
314
 
315
+ /**
316
+ * ========== STEP #6 ==========
317
+ */
318
+ public function update_settings() {
319
+ LP_Debug::instance()->add( __FUNCTION__, 'lp-updater-300', false, true );
320
+
321
  global $wpdb;
322
  $query = $wpdb->prepare( "
323
+ SELECT *
324
+ FROM {$wpdb->options}
325
+ WHERE option_name LIKE %s
326
+ ", $wpdb->esc_like( 'learn_press' ) . '%' );
 
 
 
 
 
 
 
 
 
 
 
 
 
327
 
328
+ $settings_defaults = array();
329
+ if ( $rows = $wpdb->get_results( $query ) ) {
330
+ foreach ( $rows as $row ) {
331
+ $settings_defaults[ $row->option_name ] = $row->option_value;
332
  }
333
+ }
334
 
335
+ $new_options = array(
336
+ 'learn_press_profile_avatar' => 'yes',
337
+ 'learn_press_profile_publicity' => array( 'dashboard' => 'yes' )
338
+ );
 
 
339
 
340
+ foreach ( $new_options as $k => $v ) {
341
+ if ( ! array_key_exists( $k, $settings_defaults ) ) {
342
+ update_option( $k, $v, 'yes' );
 
 
 
 
 
 
 
 
 
 
343
  }
 
 
 
 
 
344
  }
345
 
346
+ return $this->_next_step();
347
  }
348
 
349
  /**
352
  *
353
  * @return array
354
  */
355
+ public function _create_child_orders( $order, $user_ids ) {
356
  $new_orders = array();
357
  if ( $child_orders = $order->get_child_orders( true ) ) {
358
  foreach ( $child_orders as $child_id ) {
386
  return $new_orders;
387
  }
388
 
389
+ public function get_child_orders( $parent_id ) {
390
  global $wpdb;
391
  $order = new LP_Order( $parent_id );
392
  LP_Debug::instance()->add( $order->get_child_orders(), false, false, true );
394
  return $order->get_child_orders();
395
  }
396
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
 
398
  /**
399
  * Get user course items from learnpress_user_items.
402
  *
403
  * @return array
404
  */
405
+ public function _get_current_item_courses( $course_ids ) {
406
  global $wpdb;
407
  $query_args = $course_ids;
408
  $format = array_fill( 0, sizeof( $query_args ), '%d' );
422
  return $wpdb->get_results( $query );
423
  }
424
 
425
+ public function _get_item_courses( $min_user_item_id ) {
426
  global $wpdb;
 
 
 
 
 
427
 
428
+
429
+ // $query = $wpdb->prepare( "
430
+ // SELECT DISTINCT user_item_id, item_id, uim.meta_value AS `upgrade`
431
+ // FROM {$wpdb->learnpress_user_items} ui
432
+ // LEFT JOIN {$wpdb->learnpress_user_itemmeta} uim ON uim.learnpress_user_item_id = ui.user_item_id AND uim.meta_key = %s
433
+ // WHERE item_type = %s AND parent_id = 0
434
+ // HAVING `upgrade` IS NULL
435
+ // ORDER BY user_item_id ASC
436
+ // LIMIT 0, 10
437
+ // ", 'upgrade', LP_COURSE_CPT );
438
+
439
+ if ( $min_user_item_id > 0 ) {
440
+
441
+ echo $query = $wpdb->prepare( "
442
+ SELECT DISTINCT user_item_id, item_id
443
+ FROM {$wpdb->learnpress_user_items} ui
444
+ WHERE item_type = %s AND parent_id = 0
445
+ AND user_item_id >= %d
446
+ ORDER BY user_item_id ASC
447
+ LIMIT 0, 50
448
+ ", LP_COURSE_CPT, $min_user_item_id );
449
+
450
+ return $wpdb->get_results( $query );
451
+ }
452
+
453
+ return false;
454
+ }
455
+
456
+ protected function get_min_user_item_id() {
457
+ global $wpdb;
458
+ $min_user_item_id = get_option( 'lp_update_min_user_item_id' );
459
+
460
+ if ( ! $min_user_item_id ) {
461
+ $min_user_item_id = $wpdb->get_var(
462
+ $wpdb->prepare( "
463
+ SELECT MIN(user_item_id)
464
+ FROM {$wpdb->learnpress_user_items}
465
+ WHERE item_type = %s
466
+ ", 'lp_course' )
467
+ );
468
+ }
469
+
470
+ return $min_user_item_id;
471
  }
472
 
473
+ public function update_users() {
474
  // create table _learnpress_users
475
  // insert new row
476
  }
477
  }
478
 
479
+ $updater = new LP_Update_30();
inc/updates/learnpress-update-3.0.4.php CHANGED
@@ -3,38 +3,24 @@
3
  * Todo: update emails
4
  */
5
 
 
6
 
7
  /**
8
  * Class LP_Update_304
9
  *
10
  * Helper class for updating database to 3.0.4
11
  */
12
- class LP_Update_304 {
13
 
14
- /**
15
- * Entry point
16
- */
17
- public static function update() {
18
- LP_Debug::startTransaction();
19
- try {
20
- self::update_item_meta();
21
 
22
- LP_Install::update_db_version();
23
- LP_Install::update_version();
24
-
25
- set_transient( 'lp_upgraded_30', 'yes', DAY_IN_SECONDS );
26
- LP_Debug::commitTransaction();
27
- }
28
- catch ( Exception $exception ) {
29
- LP_Debug::rollbackTransaction();
30
- }
31
  }
32
 
33
- public static function update_item_meta(){
34
-
35
- }
36
 
37
- protected static function _update_item_meta() {
38
  global $wpdb;
39
  $query = $wpdb->prepare( "
40
  SELECT pm1.learnpress_user_item_id, pm1.meta_value AS question_answers, pm2.meta_value AS _question_answers
@@ -46,13 +32,13 @@ class LP_Update_304 {
46
  ", '_question_answers', 'question_answers' );
47
 
48
  if ( ! $rows = $wpdb->get_results( $query ) ) {
49
- return false;
50
  }
51
 
52
- $sqlUpdate = $wpdb->prepare( "
53
  INSERT INTO {$wpdb->learnpress_user_itemmeta}(learnpress_user_item_id, meta_key, meta_value)
54
  VALUES
55
- " );
56
 
57
  $updateRows = array();
58
  $count = 0;
@@ -79,4 +65,5 @@ class LP_Update_304 {
79
  }
80
  }
81
 
 
82
  //LP_Update_304::update();
3
  * Todo: update emails
4
  */
5
 
6
+ include_once dirname( __FILE__ ) . '/learnpress-update-base.php';
7
 
8
  /**
9
  * Class LP_Update_304
10
  *
11
  * Helper class for updating database to 3.0.4
12
  */
13
+ class LP_Update_304 extends LP_Update_Base {
14
 
15
+ public function __construct() {
16
+ $this->version = '3.0.4';
17
+ $this->steps = array( 'update_item_meta' );
 
 
 
 
18
 
19
+ parent::__construct();
 
 
 
 
 
 
 
 
20
  }
21
 
22
+ public function update_item_meta() {
 
 
23
 
 
24
  global $wpdb;
25
  $query = $wpdb->prepare( "
26
  SELECT pm1.learnpress_user_item_id, pm1.meta_value AS question_answers, pm2.meta_value AS _question_answers
32
  ", '_question_answers', 'question_answers' );
33
 
34
  if ( ! $rows = $wpdb->get_results( $query ) ) {
35
+ return $this->_next_step();
36
  }
37
 
38
+ $sqlUpdate = "
39
  INSERT INTO {$wpdb->learnpress_user_itemmeta}(learnpress_user_item_id, meta_key, meta_value)
40
  VALUES
41
+ ";
42
 
43
  $updateRows = array();
44
  $count = 0;
65
  }
66
  }
67
 
68
+ return new LP_Update_304();
69
  //LP_Update_304::update();
inc/updates/learnpress-update-3.0.8.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Todo: update emails
4
+ */
5
+
6
+ include_once dirname( __FILE__ ) . '/learnpress-update-base.php';
7
+
8
+ /**
9
+ * Class LP_Update_308
10
+ *
11
+ * Helper class for updating database to 3.0.8
12
+ */
13
+ class LP_Update_308 extends LP_Update_Base {
14
+
15
+ public function __construct() {
16
+ $this->version = '3.0.8';
17
+ $this->steps = array( 'update_item_meta' );
18
+
19
+ parent::__construct();
20
+ }
21
+
22
+ public function update_item_meta() {
23
+ $this->_next_step();
24
+
25
+ return;
26
+ }
27
+ }
28
+
29
+ return new LP_Update_308();
inc/updates/learnpress-update-base.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class LP_Update_Base
5
+ *
6
+ * Helper class for updating database
7
+ */
8
+ class LP_Update_Base {
9
+
10
+ /**
11
+ * @var array
12
+ */
13
+ protected $steps = array();
14
+
15
+ /**
16
+ * @var string
17
+ */
18
+ protected $version = '';
19
+
20
+ /**
21
+ * LP_Update_Base constructor.
22
+ */
23
+ public function __construct() {
24
+ add_filter( 'query', array( $this, 'log_query' ) );
25
+ $this->_get_version();
26
+ $this->update();
27
+ }
28
+
29
+ /**
30
+ * Get version number from file name in case it is not defined.
31
+ *
32
+ * @return string
33
+ */
34
+ protected function _get_version() {
35
+ if ( empty( $this->version ) ) {
36
+ if ( preg_match( '~-([0-9.]+)$~', basename( __FILE__, '.php' ), $m ) ) {
37
+ $this->version = $m[1];
38
+ }
39
+ }
40
+
41
+ return $this->version;
42
+ }
43
+
44
+ public function log_query( $query ) {
45
+ global $wpdb;
46
+ if ( preg_match_all( '#' . $wpdb->prefix . 'learnpress#im', $query )
47
+ || preg_match_all( '#' . $wpdb->prefix . 'posts#im', $query )
48
+ || preg_match_all( '#' . $wpdb->prefix . 'postmeta#im', $query )
49
+ ) {
50
+ LP_Debug::instance()->add( "===== " . $this->version . " ===== \n" . $query, 'query-updater', false, true );
51
+ }
52
+
53
+ return $query;
54
+ }
55
+
56
+ /**
57
+ * Entry point
58
+ */
59
+ public function update() {
60
+
61
+ $db_version = get_option( 'learnpress_db_version' );
62
+ if ( $db_version && version_compare( $db_version, $this->version, '>' ) ) {
63
+ return false;
64
+ }
65
+
66
+ $step = get_option( 'learnpress_updater_step' );
67
+ try {
68
+
69
+ if ( ! $step ) {
70
+ $step = reset( $this->steps );
71
+ update_option( 'learnpress_updater_step', $step );
72
+ }
73
+
74
+ $running_step = get_option( 'learnpress_updater_running_step' );
75
+
76
+ foreach ( $this->steps as $callback ) {
77
+ if ( $callback == $step ) {
78
+ if ( is_callable( array( $this, $callback ) ) ) {
79
+
80
+ // if ( $running_step === $step ) {
81
+ // break;
82
+ // }
83
+
84
+ echo "Running " . get_class( $this ) . '::' . $callback, "\n";
85
+ update_option( 'learnpress_updater_running_step', $step );
86
+ call_user_func( array( $this, $callback ) );
87
+ delete_option( 'learnpress_updater_running_step' );
88
+ }
89
+ break;
90
+ }
91
+ }
92
+
93
+ }
94
+ catch ( Exception $exception ) {
95
+ LP_Debug::rollbackTransaction();
96
+ }
97
+
98
+ return false;
99
+ }
100
+
101
+ /**
102
+ * Move to next step
103
+ */
104
+ protected function _next_step() {
105
+ $step = get_option( 'learnpress_updater_step' );
106
+ if ( false !== ( $pos = array_search( $step, $this->steps ) ) ) {
107
+ $pos ++;
108
+ $next_step = ! empty( $this->steps[ $pos ] ) ? $this->steps[ $pos ] : '';
109
+
110
+ if ( $next_step ) {
111
+ update_option( 'learnpress_updater_step', $next_step );
112
+ } else {
113
+ delete_option( 'learnpress_updater_step' );
114
+ delete_option( 'learnpress_updater' );
115
+ LP_Install::update_db_version( $this->version );
116
+ }
117
+ }
118
+
119
+ return true;
120
+ }
121
+ }
inc/user-item/class-lp-user-item-course.php CHANGED
@@ -44,6 +44,7 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
44
  if ( ! $this->_loaded ) {
45
  $this->read_items();
46
  $this->read_items_meta();
 
47
  }
48
  }
49
 
@@ -107,6 +108,16 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
107
  return parent::is_exceeded();
108
  }
109
 
 
 
 
 
 
 
 
 
 
 
110
  /**
111
  * Read item meta.
112
  *
@@ -246,11 +257,15 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
246
  'count_items' => $count_items,
247
  'completed_items' => $completed_items,
248
  'skipped_items' => $count_items - $completed_items,
249
- 'status' => $this->get_status()
 
250
  )
251
  );
252
 
253
- $results['grade'] = $this->is_finished() ? $this->_is_passed( $results['result'] ) : 'in-progress';
 
 
 
254
  }
255
 
256
  if ( $prop === 'status' ) {
@@ -417,7 +432,7 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
417
 
418
  $cache_key = 'user-course-' . $this->get_user_id() . '-' . $this->get_id();
419
 
420
- if ( false === ( $cached_data = wp_cache_get( $cache_key, 'course-results' )) || ! array_key_exists( 'passed-quizzes', $cached_data ) ) {
421
 
422
  $data = array( 'result' => 0, 'grade' => '', 'status' => $this->get_status() );
423
  $result = 0;
@@ -710,6 +725,31 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
710
  return apply_filters( 'learn-press/course/single-params', $js_args, $this->get_id() );
711
  }
712
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
713
  /**
714
  * Get number of retaken times for user course.
715
  *
44
  if ( ! $this->_loaded ) {
45
  $this->read_items();
46
  $this->read_items_meta();
47
+ $this->_loaded = true;
48
  }
49
  }
50
 
108
  return parent::is_exceeded();
109
  }
110
 
111
+ public function get_finishing_type() {
112
+ if ( ! $type = $this->get_meta( 'finishing_type' ) ) {
113
+ $type = $this->is_exceeded() <= 0 ? 'exceeded' : 'click';
114
+ learn_press_update_user_item_meta( $this->get_user_item_id(), 'finishing_type', $type );
115
+ $this->set_meta( 'finishing_type', $type );
116
+ }
117
+
118
+ return $type;
119
+ }
120
+
121
  /**
122
  * Read item meta.
123
  *
257
  'count_items' => $count_items,
258
  'completed_items' => $completed_items,
259
  'skipped_items' => $count_items - $completed_items,
260
+ 'status' => $this->get_status(),
261
+ 'grade' => ''
262
  )
263
  );
264
 
265
+ if ( ! in_array( $this->get_status(), array( 'purchased', 'viewed' ) ) ) {
266
+ $results['grade'] = $this->is_finished() ? $this->_is_passed( $results['result'] ) : 'in-progress';
267
+ } else {
268
+ }
269
  }
270
 
271
  if ( $prop === 'status' ) {
432
 
433
  $cache_key = 'user-course-' . $this->get_user_id() . '-' . $this->get_id();
434
 
435
+ if ( false === ( $cached_data = wp_cache_get( $cache_key, 'course-results' ) ) || ! array_key_exists( 'passed-quizzes', $cached_data ) ) {
436
 
437
  $data = array( 'result' => 0, 'grade' => '', 'status' => $this->get_status() );
438
  $result = 0;
725
  return apply_filters( 'learn-press/course/single-params', $js_args, $this->get_id() );
726
  }
727
 
728
+ public function update_item_retaken_count( $item_id, $count = 0 ) {
729
+ $items = $this->get_meta( '_retaken_items' );
730
+ if ( is_string( $count ) && preg_match( '#^(\+|\-)([0-9]+)#', $count, $m ) ) {
731
+ $last_count = ! empty( $items[ $item_id ] ) ? $items[ $item_id ] : 0;
732
+ $count = $m[1] == '+' ? ( $last_count + $m[2] ) : ( $last_count - $m[2] );
733
+ }
734
+
735
+ $items[ $item_id ] = $count;
736
+
737
+ learn_press_update_user_item_meta( $this->get_user_item_id(), '_retaken_items', $items );
738
+
739
+ return $count;
740
+ }
741
+
742
+ public function get_item_retaken_count( $item_id ) {
743
+ $items = $this->get_meta( '_retaken_items' );
744
+ $count = false;
745
+
746
+ if ( is_array( $items ) && array_key_exists( $item_id, $items ) ) {
747
+ $count = absint( $items[ $item_id ] );
748
+ }
749
+
750
+ return $count;
751
+ }
752
+
753
  /**
754
  * Get number of retaken times for user course.
755
  *
inc/user-item/class-lp-user-item-quiz.php CHANGED
@@ -75,21 +75,26 @@ class LP_User_Item_Quiz extends LP_User_Item {
75
  * @return int|LP_Question
76
  */
77
  public function get_current_question( $return = '' ) {
78
- $question = $this->get_meta( '_current_question', true );
79
- if ( ! $question ) {
 
 
80
  if ( $questions = $this->get_quiz()->get_questions() ) {
81
- $question = reset( $questions );
82
- $this->set_meta( '_current_question', $question );
83
  $this->update_meta();
 
 
84
  }
85
  }
86
- if ( $question ) {
 
87
  if ( $return == 'object' ) {
88
- $question = learn_press_get_question( $question );
89
  }
90
  }
91
 
92
- return $question;
93
  }
94
 
95
  /**
@@ -164,7 +169,7 @@ class LP_User_Item_Quiz extends LP_User_Item {
164
 
165
  $result['question_count'] = sizeof( $questions );
166
 
167
- if ( false === learn_press_get_user_item_meta( $this->get_user_item_id(), 'grade', true ) ) {
168
  learn_press_update_user_item_meta( $this->get_user_item_id(), 'grade', $result['grade'] );
169
  }
170
  }
@@ -197,6 +202,16 @@ class LP_User_Item_Quiz extends LP_User_Item {
197
  return $interval;
198
  }
199
 
 
 
 
 
 
 
 
 
 
 
200
 
201
  public function is_answered( $question_id ) {
202
  $result = $this->get_results();
@@ -455,7 +470,9 @@ class LP_User_Item_Quiz extends LP_User_Item {
455
  }
456
 
457
  public function finish() {
458
- $this->set_end_time( current_time( "mysql" ) );
 
 
459
  $this->set_status( 'completed' );
460
  $this->update();
461
  }
75
  * @return int|LP_Question
76
  */
77
  public function get_current_question( $return = '' ) {
78
+ $question_id = $this->get_meta( '_current_question', true );
79
+ $question = learn_press_get_question( $question_id );
80
+
81
+ if ( ! $question || ! $question->is_publish() ) {
82
  if ( $questions = $this->get_quiz()->get_questions() ) {
83
+ $question_id = reset( $questions );
84
+ $this->set_meta( '_current_question', $question_id );
85
  $this->update_meta();
86
+ } else {
87
+ $question_id = 0;
88
  }
89
  }
90
+
91
+ if ( $question_id ) {
92
  if ( $return == 'object' ) {
93
+ return learn_press_get_question( $question_id );
94
  }
95
  }
96
 
97
+ return $question_id;
98
  }
99
 
100
  /**
169
 
170
  $result['question_count'] = sizeof( $questions );
171
 
172
+ if ( $result['grade'] != learn_press_get_user_item_meta( $this->get_user_item_id(), 'grade', true ) ) {
173
  learn_press_update_user_item_meta( $this->get_user_item_id(), 'grade', $result['grade'] );
174
  }
175
  }
202
  return $interval;
203
  }
204
 
205
+ /**
206
+ * Return TRUE if user has pressed SKIP on this question
207
+ *
208
+ * @param int $question_id
209
+ *
210
+ * @return bool
211
+ */
212
+ public function is_skipped( $question_id ) {
213
+ return $this->get_question_answer( $question_id ) === '__SKIPPED__';
214
+ }
215
 
216
  public function is_answered( $question_id ) {
217
  $result = $this->get_results();
470
  }
471
 
472
  public function finish() {
473
+ $time = new LP_Datetime();
474
+ $this->set_end_time( $time->toSql() );
475
+ $this->set_end_time_gmt( $time->toSql( false ) );
476
  $this->set_status( 'completed' );
477
  $this->update();
478
  }
inc/user-item/class-lp-user-item.php CHANGED
@@ -58,11 +58,10 @@ class LP_User_Item extends LP_Abstract_Object_Data {
58
  */
59
  public function get_start_time( $format = '' ) {
60
  $time = $this->get_data( 'start_time' );
61
-
62
  $date = new LP_Datetime( $time );
63
 
64
  if ( $format ) {
65
- return $format = 'i18n' ? learn_press_date_i18n( $date->getTimestamp() ) : $date->format( $format );
66
  }
67
 
68
  return $date;
@@ -75,7 +74,7 @@ class LP_User_Item extends LP_Abstract_Object_Data {
75
  public function get_start_time_gmt( $format = '' ) {
76
  $date = new LP_Datetime( $this->get_data( 'start_time_gmt' ) );
77
  if ( $format ) {
78
- return $format = 'i18n' ? learn_press_date_i18n( $date->getTimestamp() ) : $date->format( $format );
79
  }
80
 
81
  return $date;
@@ -339,6 +338,7 @@ class LP_User_Item extends LP_Abstract_Object_Data {
339
  'enrolled' => __( 'In Progress', 'learnpress' ),
340
  'started' => __( 'In Progress', 'learnpress' ),
341
  'in-progress' => __( 'In Progress', 'learnpress' ),
 
342
  'completed' => __( 'Completed', 'learnpress' ),
343
  'finished' => __( 'Finished', 'learnpress' ),
344
  'passed' => __( 'Passed', 'learnpress' ),
@@ -349,7 +349,7 @@ class LP_User_Item extends LP_Abstract_Object_Data {
349
  $status = $this->get_status();
350
  }
351
 
352
- return ! empty( $statuses[ $status ] ) ? $statuses[ $status ] : __( 'Not enrolled', 'learnpress' );
353
  }
354
 
355
  /**
@@ -391,6 +391,10 @@ class LP_User_Item extends LP_Abstract_Object_Data {
391
  return 0;
392
  }
393
 
 
 
 
 
394
  /**
395
  * Return number of seconds has exceeded.
396
  * If less than or equals to 0 that means the time is exceeded.
@@ -463,8 +467,9 @@ class LP_User_Item extends LP_Abstract_Object_Data {
463
  }
464
 
465
  public function maybe_update_item_grade() {
466
- $result = $this->get_result();
467
- learn_press_update_user_item_meta( $this->get_user_item_id(), 'grade', $result['grade'] );
 
468
  }
469
 
470
  public function delete_meta_data( $include = '', $exclude = '' ) {
@@ -549,4 +554,5 @@ class LP_User_Item extends LP_Abstract_Object_Data {
549
 
550
  return false;
551
  }
552
- }
 
58
  */
59
  public function get_start_time( $format = '' ) {
60
  $time = $this->get_data( 'start_time' );
 
61
  $date = new LP_Datetime( $time );
62
 
63
  if ( $format ) {
64
+ return $date->is_null() ? false : ( $format = 'i18n' ? learn_press_date_i18n( $date->getTimestamp() ) : $date->format( $format ) );
65
  }
66
 
67
  return $date;
74
  public function get_start_time_gmt( $format = '' ) {
75
  $date = new LP_Datetime( $this->get_data( 'start_time_gmt' ) );
76
  if ( $format ) {
77
+ return $date->is_null() ? false : ( $format = 'i18n' ? learn_press_date_i18n( $date->getTimestamp() ) : $date->format( $format ) );
78
  }
79
 
80
  return $date;
338
  'enrolled' => __( 'In Progress', 'learnpress' ),
339
  'started' => __( 'In Progress', 'learnpress' ),
340
  'in-progress' => __( 'In Progress', 'learnpress' ),
341
+ 'purchased' => __( 'Not Enrolled', 'learnpress' ),
342
  'completed' => __( 'Completed', 'learnpress' ),
343
  'finished' => __( 'Finished', 'learnpress' ),
344
  'passed' => __( 'Passed', 'learnpress' ),
349
  $status = $this->get_status();
350
  }
351
 
352
+ return ! empty( $statuses[ $status ] ) ? $statuses[ $status ] : __( 'Not Enrolled', 'learnpress' );
353
  }
354
 
355
  /**
391
  return 0;
392
  }
393
 
394
+ public function remove_user_items_history( $keep = 10 ) {
395
+ learn_press_remove_user_items_history( $this->get_item_id(), $this->get_course( 'id' ), $this->get_user_id(), $keep );
396
+ }
397
+
398
  /**
399
  * Return number of seconds has exceeded.
400
  * If less than or equals to 0 that means the time is exceeded.
467
  }
468
 
469
  public function maybe_update_item_grade() {
470
+ $grade = $this->get_result( 'grade' );
471
+
472
+ learn_press_update_user_item_meta( $this->get_user_item_id(), 'grade', $grade ? $grade : '' );
473
  }
474
 
475
  public function delete_meta_data( $include = '', $exclude = '' ) {
554
 
555
  return false;
556
  }
557
+ }
558
+
inc/user/abstract-lp-user.php CHANGED
@@ -344,6 +344,24 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
344
  return $records;
345
  }
346
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
347
  /**
348
  * Start quiz for the user.
349
  *
@@ -381,7 +399,7 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
381
  $course = learn_press_get_course( $course_id );
382
  $user = LP_Global::user();
383
 
384
- if ( $course->is_required_enroll() && $user->is( 'guest' ) ) {
385
  throw new Exception( __( 'You have to login for starting quiz.', 'learnpress' ), LP_REQUIRE_LOGIN );
386
  }
387
 
@@ -525,9 +543,39 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
525
  }
526
 
527
  protected function _insert_quiz_item( $quiz_id, $course_id ) {
528
- $course_data = $this->get_course_data( $course_id );
529
- $start_time = new LP_Datetime( current_time( 'mysql' ) );
530
- $item_data = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
531
  'user_id' => $this->get_id(),
532
  'item_id' => $quiz_id,
533
  'start_time' => $start_time->toSql(),
@@ -544,6 +592,7 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
544
 
545
  $last_results = $this->get_item_archive( $quiz_id, $course_id, true );
546
  $set_current_question = false;
 
547
  // If there is no a record
548
  if ( ! $last_results ) {
549
  $item_data = apply_filters( 'learn-press/insert-user-item-data', $item_data, $quiz_id, $course_id, $this->get_id() );
@@ -623,6 +672,8 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
623
  }
624
 
625
  public function get_current_question_id( $quiz_id = 0 ) {
 
 
626
  $current = false;
627
  $quiz_current_question = $this->quiz_current_question;
628
  if ( is_array( $quiz_current_question ) && ! empty( $quiz_current_question[ $quiz_id ] ) ) {
@@ -923,6 +974,7 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
923
  */
924
  public function get_current_question( $quiz_id, $course_id, $permalink = false ) {
925
  $data = $this->get_course_data( $course_id );
 
926
  if ( empty( $data[ $quiz_id ] ) ) {
927
  return false;
928
  }
@@ -1454,62 +1506,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1454
  return $posts;
1455
  }
1456
 
1457
- /**
1458
- * Get all quizzes of the user
1459
- *
1460
- * @param array $args - actually, it as the same with WP_Query args
1461
- * @param bool
1462
- *
1463
- * @return array
1464
- */
1465
- public function get_quizzes( &$args = array(), $force = false ) {
1466
- static $quizzes = array();
1467
- settype( $args, 'array' );
1468
-
1469
- $args = wp_parse_args(
1470
- $args,
1471
- array(
1472
- 'limit' => - 1,
1473
- 'paged' => get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1,
1474
- 'status' => array( 'started', 'finished' ),
1475
- 'total' => 5
1476
- )
1477
- );
1478
- $args['post_type'] = LP_QUIZ_CPT;
1479
- $key = md5( serialize( $args ) );
1480
- if ( empty( $quizzes[ $key ] ) || $force ) {
1481
- global $wpdb;
1482
- //$where = $wpdb->prepare( "\nWHERE uq.user_id = %d", $this->get_id() );
1483
- $limit = "\n";
1484
- if ( $args['limit'] > 0 ) {
1485
- if ( ! $args['paged'] ) {
1486
- $args['paged'] = 1;
1487
- }
1488
- $start = ( $args['paged'] - 1 ) * $args['limit'];
1489
- $limit .= "LIMIT " . $start . ',' . $args['limit'];
1490
- }
1491
- $query = $wpdb->prepare( "
1492
- SELECT SQL_CALC_FOUND_ROWS DISTINCT q.*
1493
- FROM {$wpdb->posts} q
1494
- INNER JOIN {$wpdb->prefix}learnpress_user_items uq ON uq.item_id = q.ID
1495
- WHERE uq.user_id = %d AND uq.item_type = %s
1496
- ", $this->get_id(), 'lp_quiz' );
1497
-
1498
- $query = $query . $limit;
1499
- $rows = $wpdb->get_results( $query );
1500
- $total = $wpdb->get_var( "SELECT FOUND_ROWS()" );
1501
- $quizzes[ $key ] = array(
1502
- 'rows' => $rows,
1503
- 'total' => $total
1504
- );
1505
- $args['total'] = $total;
1506
- } else {
1507
- $args['total'] = $quizzes[ $key ]['total'];
1508
- }
1509
-
1510
- return apply_filters( 'learn_press_get_user_quizzes', $quizzes[ $key ]['rows'], $args );
1511
- }
1512
-
1513
  /**
1514
  * Get all quizzes of the user
1515
  *
@@ -1539,6 +1535,7 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1539
  * @throws Exception
1540
  */
1541
  public function can( $role ) {
 
1542
  $args = func_get_args();
1543
  unset( $args[0] );
1544
  $method = 'can_' . preg_replace( '!-!', '_', $role );
@@ -1553,7 +1550,7 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1553
  /**
1554
  * Return true if user can purchase a course
1555
  *
1556
- * @param $course_id
1557
  *
1558
  * @return bool
1559
  */
@@ -1562,9 +1559,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1562
  $purchasable = $course->is_purchasable();
1563
 
1564
  if ( $purchasable && $order = $this->has_ordered_course( $course_id ) ) {
1565
- // if($this->has_finished_course($course_id) && in_array( $order->get_status(), array('pending', 'completed') )){
1566
- //
1567
- // }
1568
  }
1569
 
1570
  // @deprecated
@@ -1584,7 +1578,8 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1584
  public function can_enroll_course( $course_id ) {
1585
  $course = learn_press_get_course( $course_id );
1586
 
1587
- $can_enroll = ! ! $course && $course->is_publish();
 
1588
 
1589
  if ( $can_enroll && $course->is_free() && ! $course->is_required_enroll() && ! $course->is_in_stock() ) {
1590
  $can_enroll = false;
@@ -1661,14 +1656,18 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1661
  $lesson = LP_Lesson::get_lesson( $lesson_id );
1662
 
1663
  if ( $course = learn_press_get_course( $course_id ) ) {
1664
- if ( $this->has_enrolled_course( $course_id ) || $this->has( 'finished-course', $course_id ) ) {
1665
  // or user has enrolled course
1666
  $view = 'enrolled';
1667
  } elseif ( $lesson->is_preview() || $this->is_admin() || ( $this->is_instructor() && $course->get_instructor( 'id' ) == $this->get_id() ) ) {
1668
  $view = 'preview';
1669
- } elseif ( ! $course->is( 'required_enroll' ) ) {
1670
  // if course is not required enroll so the lesson is previewable
1671
  $view = 'no-required-enroll';
 
 
 
 
1672
  }
1673
  }
1674
  }
@@ -1701,11 +1700,11 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1701
  }
1702
 
1703
  if ( $course ) {
1704
- if ( $this->has( 'enrolled-course', $course_id ) || $this->has( 'finished-course', $course_id ) ) {
1705
  $view = 'enrolled';
1706
  } elseif ( $this->is_admin() || ( $this->is_instructor() && $course->get_instructor( 'id' ) == $this->get_id() ) ) {
1707
  $view = 'preview';
1708
- } elseif ( ! $course->is( 'required_enroll' ) ) {
1709
  $view = 'no-required-enroll';
1710
  }
1711
  }
@@ -1723,15 +1722,17 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1723
  * - FALSE if user CAN NOT retake quiz
1724
  * - INT (number of remain) if user CAN retake quiz
1725
  *
1726
- * @param $quiz_id
1727
- * @param int $course_id
1728
  *
1729
- * @return mixed|null
1730
  */
1731
  public function can_retake_quiz( $quiz_id, $course_id = 0 ) {
1732
  $can = false;
1733
  $course = learn_press_get_course( $course_id );
 
1734
  if ( $course && $course->has_item( $quiz_id ) ) {
 
1735
  // Check if quiz is already exists
1736
  if ( $quiz = learn_press_get_quiz( $quiz_id ) ) {
1737
  $count = $quiz->get_retake_count();
@@ -1743,11 +1744,12 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1743
  } else {
1744
  $can = $count;
1745
  }
 
 
1746
  }
1747
  }
1748
  }
1749
 
1750
-
1751
  return apply_filters( 'learn_press_user_can_retake_quiz', $can, $quiz_id, $this->get_id(), $course_id );
1752
  }
1753
 
@@ -1847,7 +1849,7 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1847
  public function finish_course( $course_id ) {
1848
  $return = false;
1849
  if ( $course = learn_press_get_course( $course_id ) ) {
1850
- if ( ! $this->can( 'finish-course', $course_id ) ) {
1851
  return false;
1852
  } else {
1853
  $user_course = $this->get_course_data( $course_id );
@@ -1886,6 +1888,8 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1886
  }
1887
 
1888
  public function has( $role ) {
 
 
1889
  $args = func_get_args();
1890
  unset( $args[0] );
1891
  $method = 'has_' . preg_replace( '!-!', '_', $role );
@@ -1949,16 +1953,23 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
1949
  * @return bool
1950
  */
1951
  public function has_enrolled_course( $course_id, $force = false ) {
1952
- $enrolled = false;
 
1953
 
1954
- // No new order is pending and has already enrolled or finished course
1955
- if ( 'lp-pending' !== $this->get_order_status( $course_id ) ) {
1956
- $enrolled = $this->has_course_status( $course_id, array(
1957
- 'enrolled',
1958
- 'finished'
1959
- ) );
 
 
 
1960
  }
1961
 
 
 
 
1962
  $enrolled = apply_filters( 'learn_press_user_has_enrolled_course', $enrolled, $this, $course_id );
1963
 
1964
  /**
@@ -2088,18 +2099,36 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
2088
  * @return int
2089
  */
2090
  public function count_retaken_quiz( $quiz_id, $course_id = 0, $force = false ) {
2091
- $count = false;
2092
-
2093
  $course_id = $this->_get_course( $course_id );
2094
 
2095
  if ( ! $course_id || ! $quiz_id ) {
2096
  return $count;
2097
  }
2098
 
2099
- $count = 0;
2100
- $user_item = $this->get_item_data( $quiz_id, $course_id );
2101
- if ( $user_item ) {
2102
- $count = $user_item->count_history() - 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2103
  }
2104
 
2105
  return apply_filters( 'learn_press_user_count_retaken_quiz', $count, $quiz_id, $course_id, $this->get_id() );
@@ -2129,7 +2158,7 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
2129
  }
2130
 
2131
  public function retake_course( $course_id ) {
2132
- if ( ! $this->can( 'retake-course', $course_id ) ) {
2133
  return false;
2134
  }
2135
 
@@ -2359,75 +2388,8 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
2359
  */
2360
  public function evaluate_quiz_results( $quiz_id, $progress ) {
2361
  _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '3.0.0' );
2362
- $quiz = LP_Quiz::get_quiz( $quiz_id );
2363
- $results = array(
2364
- 'mark' => 0,
2365
- 'correct' => 0,
2366
- 'wrong' => 0,
2367
- 'empty' => 0,
2368
- 'mark_percent' => 0,
2369
- 'correct_percent' => 0,
2370
- 'wrong_percent' => 0,
2371
- 'empty_percent' => 0,
2372
- //'quiz_time' => $quiz->get_duration(),
2373
- 'quiz_mark' => $quiz->get_mark(),
2374
- 'time' => 0,
2375
- 'questions' => array()
2376
- );
2377
- $questions = $quiz->get_questions();
2378
- if ( $questions ) {
2379
- $questions = array_keys( $questions );
2380
- $results['questions'] = $questions;
2381
- }
2382
- if ( ! empty( $questions ) ) {
2383
- $question_answers = ! empty( $progress->question_answers ) ? $progress->question_answers : array();
2384
- foreach ( $questions as $question_id ) {
2385
- if ( is_array( $question_answers ) && array_key_exists( $question_id, $question_answers ) && ! is_null( $question_answers[ $question_id ] ) ) {
2386
- $question = LP_Question::get_question( $question_id );
2387
- $check = $question->check( $question_answers[ $question_id ] );
2388
-
2389
- if ( $check['correct'] ) {
2390
- $results['correct'] ++;
2391
- } else {
2392
- $results['wrong'] ++;
2393
- }
2394
- $results['mark'] += ! empty( $check['mark'] ) ? $check['mark'] : 0;
2395
- } else {
2396
- $check = false;
2397
- $results['empty'] ++;
2398
- }
2399
- $results['answer_results'][ $question_id ] = $check;
2400
- }
2401
- }
2402
- if ( $total_questions = sizeof( $questions ) ) {
2403
- $results['correct_percent'] = round( $results['correct'] / $total_questions * 100 );
2404
- $results['wrong_percent'] = round( $results['wrong'] / $total_questions * 100 );
2405
- $results['empty_percent'] = round( $results['empty'] / $total_questions * 100 );
2406
- }
2407
- $results['time'] = $this->_calculate_quiz_time( $quiz, $progress );
2408
- if ( $results['quiz_mark'] ) {
2409
- $results['mark_percent'] = round( $results['mark'] / $results['quiz_mark'] * 100 );
2410
- }
2411
 
2412
- return apply_filters( 'learn_press_evaluate_quiz_results', $results, $quiz_id, $this->get_id() );
2413
- }
2414
-
2415
-
2416
- /**
2417
- * @param $quiz
2418
- * @param $progress
2419
- *
2420
- * @return int
2421
- */
2422
- private function _calculate_quiz_time( $quiz, $progress ) {
2423
- $start = strtotime( $progress->start );
2424
- $end = strtotime( $progress->end );
2425
- if ( $end < $start ) {
2426
- $end = $start + $quiz->get_duration();
2427
- //learn_press_update_user_quiz_meta( $progress->history_id, 'end', $end );
2428
- }
2429
-
2430
- return $end - $start;
2431
  }
2432
 
2433
  /**
@@ -2497,6 +2459,7 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
2497
  * @return mixed|void
2498
  */
2499
  public function has_completed_item( $item, $course_id = 0, $force = false ) {
 
2500
  $course_id = $this->_get_course( $course_id );
2501
 
2502
  $return = false;
@@ -2664,121 +2627,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
2664
  }
2665
  }
2666
 
2667
- /**
2668
- * @param array $args
2669
- *
2670
- * @return mixed
2671
- */
2672
- public function get_questions( $args = array() ) {
2673
- static $questions = array();
2674
- if ( ! is_array( $args ) ) {
2675
- $args = array(
2676
- 'post_per_page' => 9999
2677
- );
2678
- }
2679
-
2680
- $args['post_type'] = LP_QUESTION_CPT;
2681
- $args['author'] = $this->get_id();
2682
-
2683
- $key = md5( serialize( $args ) );
2684
- if ( empty( $questions[ $key ] ) || ( ! empty( $args['force'] ) && $args['force'] == true ) ) {
2685
- $questions[ $key ] = get_posts( $args );
2686
- }
2687
-
2688
- return apply_filters( 'learn_press_user_questions', $questions[ $key ], $this );
2689
- }
2690
-
2691
- /**
2692
- * @param array $args
2693
- *
2694
- * @return mixed
2695
- */
2696
- public function get_courses( $args = array() ) {
2697
- global $wpdb;
2698
- static $courses = array();
2699
- $args = wp_parse_args(
2700
- $args,
2701
- array(
2702
- 'status' => '',
2703
- 'limit' => - 1,
2704
- 'paged' => get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1,
2705
- 'orderby' => 'post_title',
2706
- 'order' => 'ASC',
2707
- 'user_id' => $this->get_id()
2708
- )
2709
- );
2710
- ksort( $args );
2711
- $key = md5( serialize( $args ) );
2712
- if ( empty( $courses[ $key ] ) ) {
2713
- $where = $args['status'] ? $wpdb->prepare( "AND uc.status = %s", $args['status'] ) : '';
2714
- $limit = "\n";
2715
- if ( $args['limit'] > 0 ) {
2716
- if ( ! $args['paged'] ) {
2717
- $args['paged'] = 1;
2718
- }
2719
- $start = ( $args['paged'] - 1 ) * $args['limit'];
2720
- $limit .= "LIMIT " . $start . ',' . $args['limit'];
2721
- }
2722
- $order = "\nORDER BY " . ( $args['orderby'] ? $args['orderby'] : 'post_title' ) . ' ' . $args['order'];
2723
- $query = $wpdb->prepare( "
2724
- SELECT SQL_CALC_FOUND_ROWS * FROM(
2725
- SELECT c.*, uc.status as course_status
2726
- FROM {$wpdb->posts} c
2727
- LEFT JOIN {$wpdb->prefix}learnpress_user_items uc ON c.ID = uc.item_id AND uc.user_id = %d
2728
- WHERE post_type = %s
2729
- AND ( c.post_status = %s OR c.post_status = %s)
2730
- AND post_author = %d
2731
- UNION
2732
- SELECT c.*, uc.status as course_status
2733
- FROM {$wpdb->posts} c
2734
- INNER JOIN {$wpdb->prefix}learnpress_user_items uc ON c.ID = uc.item_id
2735
- WHERE uc.user_id = %d
2736
- AND c.post_type = %s
2737
- AND c.post_status = %s
2738
- ) a GROUP BY a.ID
2739
- ", $args['user_id'],
2740
- LP_COURSE_CPT, 'publish', 'draft', $this->get_id(),
2741
- $args['user_id'], LP_COURSE_CPT, 'publish'
2742
- );
2743
- $query .= $where . $order . $limit;
2744
-
2745
- $data = array(
2746
- 'rows' => $wpdb->get_results( $query, OBJECT_K )
2747
- );
2748
- $data['count'] = $wpdb->get_var( "SELECT FOUND_ROWS();" );
2749
-
2750
- if ( $data['rows'] ) {
2751
- $course_ids = array_keys( $data['rows'] );
2752
- learn_press_get_user_courses_info( $this->get_id(), $course_ids );
2753
-
2754
- }
2755
- $courses[ $key ] = $data;
2756
- }
2757
- $this->_FOUND_ROWS = $courses[ $key ]['count'];
2758
-
2759
- return $courses[ $key ]['rows'];
2760
- }
2761
-
2762
- /**
2763
- * @return mixed
2764
- */
2765
- public function _get_orders() {
2766
- global $wpdb;
2767
- $query = $wpdb->prepare( "
2768
- SELECT o.*
2769
- FROM {$wpdb->posts} o
2770
- INNER JOIN {$wpdb->postmeta} om ON om.post_id = o.ID AND om.meta_key = %s
2771
- INNER JOIN {$wpdb->users} u ON u.ID = om.meta_value
2772
- WHERE o.post_type = %s
2773
- AND u.ID = %d
2774
- AND o.post_status <> %s
2775
- ORDER BY `post_date` DESC
2776
- ", '_user_id', 'lp_order', $this->get_id(), 'trash' );
2777
- $orders = $wpdb->get_results( $query );
2778
-
2779
- return apply_filters( 'learn_press_user_orders', $orders, $this->get_id() );
2780
- }
2781
-
2782
  /**
2783
  * @param $question_id
2784
  *
@@ -2842,56 +2690,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
2842
  return $answered ? array_key_exists( $question_id, $answered ) : false;
2843
  }
2844
 
2845
- /**
2846
- * @param array $args
2847
- *
2848
- * @return mixed
2849
- */
2850
- public function get_enrolled_courses( $args = array() ) {
2851
- global $wpdb;
2852
- static $courses = array();
2853
- $args = wp_parse_args(
2854
- $args,
2855
- array(
2856
- 'status' => '',
2857
- 'limit' => - 1,
2858
- 'paged' => get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1,
2859
- 'user_id' => $this->get_id()
2860
- )
2861
- );
2862
- ksort( $args );
2863
- $key = md5( serialize( $args ) );
2864
- if ( empty( $courses[ $key ] ) ) {
2865
- $where = $args['status'] ? $wpdb->prepare( "AND uc.status = %s", $args['status'] ) : '';
2866
- $limit = "\n";
2867
- if ( $args['limit'] > 0 ) {
2868
- if ( ! $args['paged'] ) {
2869
- $args['paged'] = 1;
2870
- }
2871
- $start = ( $args['paged'] - 1 ) * $args['limit'];
2872
- $limit .= "LIMIT " . $start . ',' . $args['limit'];
2873
- }
2874
- $query = $wpdb->prepare( "
2875
- SELECT SQL_CALC_FOUND_ROWS c.*, uc.status as course_status
2876
- FROM {$wpdb->posts} c
2877
- INNER JOIN {$wpdb->prefix}learnpress_user_items uc ON c.ID = uc.item_id
2878
- WHERE uc.user_id = %d
2879
- AND c.post_type = %s
2880
- AND c.post_status = %s
2881
- ", $args['user_id'], 'lp_course', 'publish' );
2882
- $query .= $where . $limit;
2883
- $data = array(
2884
- 'rows' => $wpdb->get_results( $query, OBJECT_K )
2885
- );
2886
- $data['count'] = $wpdb->get_var( "SELECT FOUND_ROWS();" );
2887
-
2888
- $courses[ $key ] = $data;
2889
- }
2890
- $this->_FOUND_ROWS = $courses[ $key ]['count'];
2891
-
2892
- return $courses[ $key ]['rows'];
2893
- }
2894
-
2895
  /**
2896
  * @param array $args
2897
  *
@@ -2901,83 +2699,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
2901
  return $this->_curd->query_purchased_courses( $this->get_id(), $args );
2902
  }
2903
 
2904
- /**
2905
- * @param array $args
2906
- *
2907
- * @return mixed
2908
- */
2909
- public function get_own_courses( $args = array() ) {
2910
- global $wpdb;
2911
- static $courses = array();
2912
-
2913
- $args = wp_parse_args(
2914
- $args,
2915
- array(
2916
- 'limit' => - 1,
2917
- 'paged' => get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1,
2918
- 'user_id' => $this->get_id()
2919
- )
2920
- );
2921
- ksort( $args );
2922
- $key = md5( serialize( $args ) );
2923
- if ( empty( $courses[ $key ] ) ) {
2924
- $limit = "\n";
2925
- if ( $args['limit'] > 0 ) {
2926
- if ( ! $args['paged'] ) {
2927
- $args['paged'] = 1;
2928
- }
2929
- $start = ( $args['paged'] - 1 ) * $args['limit'];
2930
- $limit .= "LIMIT " . $start . ',' . $args['limit'];
2931
- }
2932
- $query = $wpdb->prepare( "
2933
- SELECT SQL_CALC_FOUND_ROWS c.*
2934
- FROM {$wpdb->posts} c
2935
- WHERE c.post_status = %s
2936
- AND c.post_type = %s
2937
- AND c.post_author = %d
2938
- ", 'publish', 'lp_course', $args['user_id'] );
2939
- $query .= $limit;
2940
- $data = array(
2941
- 'rows' => $wpdb->get_results( $query, OBJECT_K )
2942
- );
2943
- $data['count'] = $wpdb->get_var( "SELECT FOUND_ROWS();" );
2944
-
2945
- $courses[ $key ] = $data;
2946
-
2947
- }
2948
- $this->_FOUND_ROWS = $courses[ $key ]['count'];
2949
-
2950
- return $courses[ $key ]['rows'];
2951
- }
2952
-
2953
- /**
2954
- * @param $course_id
2955
- * @param $section_id
2956
- * @param bool $force
2957
- *
2958
- * @return int
2959
- */
2960
- function get_completed_items_in_section( $course_id, $section_id, $force = false ) {
2961
- _deprecated_function( __FUNCTION__, '3.0.0' );
2962
-
2963
- return rand( 1, 3 );
2964
-
2965
- $course = learn_press_get_course( $course_id );
2966
- $curriculum = $course->get_curriculum( $section_id );
2967
- $completed = 0;
2968
- if ( $curriculum && $curriculum->items ) {
2969
- foreach ( $curriculum->items as $item ) {
2970
- if ( $this->has_completed_item( $item->ID, $course_id, $force ) ) {
2971
- if ( $course->enable_evaluate_item( $item->ID, $this->get_id() ) ) {
2972
- $completed ++;
2973
- }
2974
- }
2975
- }
2976
- }
2977
-
2978
- return $completed;
2979
- }
2980
-
2981
  /**
2982
  * @return array
2983
  */
@@ -3026,42 +2747,6 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
3026
  return $quiz_data ? $quiz_data->has_hinted_question( $question_id ) : false;
3027
  }
3028
 
3029
- /**
3030
- * Get user's quiz's graduation
3031
- *
3032
- * @deprecated
3033
- *
3034
- * @param $quiz_id
3035
- * @param int $course_id
3036
- * @param bool $check_completed
3037
- *
3038
- * @return mixed|void
3039
- */
3040
- public function get_quiz_graduation( $quiz_id, $course_id = 0, $check_completed = true ) {
3041
- _deprecated_function( __FUNCTION__, '3.0.0' );
3042
- if ( ! $grade = LP_Cache::get_quiz_grade( sprintf( '%d-%d-%d', $this->get_id(), $course_id, $quiz_id ) ) ) {
3043
- $course_id = $this->_get_course( $course_id );
3044
- $result = $this->get_quiz_results( $quiz_id, $course_id );
3045
- $grade = '';
3046
- if ( $result && ( ( $check_completed == false ) || $check_completed && $result->status == 'completed' ) ) {
3047
- $quiz = LP_Quiz::get_quiz( $quiz_id );
3048
-
3049
- $grade_type = $quiz->passing_grade_type;
3050
- $passing_grade = $quiz->passing_grade;
3051
- if ( $grade_type == 'point' ) {
3052
- $grade = $passing_grade <= $result->mark;
3053
- } elseif ( $grade_type == 'percentage' ) {
3054
- $grade = $passing_grade <= $result->mark_percent;
3055
- } else {
3056
- $grade = true;
3057
- }
3058
- $grade = $grade ? 'passed' : 'failed';
3059
- }
3060
- }
3061
-
3062
- return apply_filters( 'learn_press_user_quiz_graduation', $grade, $quiz_id, $course_id );
3063
- }
3064
-
3065
  /**
3066
  * Return TRUE if user is already exists.
3067
  *
@@ -3197,9 +2882,9 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
3197
  public function can_do_quiz( $quiz_id, $course_id = 0 ) {
3198
  $course = learn_press_get_course( $course_id );
3199
  if ( $course->is_required_enroll() ) {
3200
- $can = $this->has_course_status( $course_id, array( 'enrolled' ) ) && ! $this->has( 'started-quiz', $quiz_id, $course_id );
3201
  } else {
3202
- $can = ! $this->has( 'started-quiz', $quiz_id, $course_id );
3203
  }
3204
 
3205
  return apply_filters( 'learn_press_user_can_do_quiz', $can, $quiz_id, $this->get_id(), $course_id );
@@ -3219,35 +2904,16 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
3219
  *
3220
  * @param $course_id
3221
  *
3222
- * @return mixed|void
3223
- * @throws Exception
3224
  */
3225
  public function get_course_grade( $course_id ) {
3226
- $course = learn_press_get_course( $course_id );
3227
- $status = $this->get( 'course-status', $course_id );
3228
- $grade = false;
3229
- if ( $status == 'finished' ) {
3230
- $result = $course->evaluate_course_results( $this->get_id() );
3231
- $current = absint( $result );
3232
- $passing_condition = absint( $course->passing_condition );
3233
- $passed = $current >= $passing_condition;
3234
- if ( $passed ) {
3235
- $grade = 'passed';
3236
- } else {
3237
- $grade = 'failed';
3238
- }
3239
- } else if ( $status && $status != 'finished' ) {
3240
- $grade = 'in-progress';
3241
- }
3242
-
3243
- return apply_filters( 'learn_press_user_course_grade', $grade, $this->get_id(), $course_id );
3244
- }
3245
 
3246
- public static function get_user() {
3247
- _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '2.0.7', 'LP_User_Factory::get_user' );
3248
- $func_args = func_get_args();
3249
 
3250
- return call_user_func_array( array( 'LP_User_Factory', 'get_user' ), $func_args );
3251
  }
3252
 
3253
  /**
@@ -3259,10 +2925,22 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
3259
  return ! $this->get_id() || ! get_user_by( 'id', $this->get_id() );
3260
  }
3261
 
 
 
 
 
 
3262
  public function read_course( $the_course ) {
3263
  $this->_curd->read_course( $this->get_id(), $the_course );
3264
  }
3265
 
 
 
 
 
 
 
 
3266
  public function can_edit( $post_id ) {
3267
  if ( $this->get_id() !== get_current_user_id() ) {
3268
  return false;
@@ -3278,30 +2956,58 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
3278
  return $this->get_data( 'email' );
3279
  }
3280
 
 
 
 
 
 
3281
  public function get_username() {
3282
  return $this->get_data( 'user_login' );
3283
  }
3284
 
 
 
 
 
 
3285
  public function get_description() {
3286
  return $this->get_data( 'description' );
3287
  }
3288
 
 
 
 
 
 
3289
  public function get_first_name() {
3290
  return $this->get_data( 'first_name' );
3291
  }
3292
 
 
 
 
 
 
3293
  public function get_last_name() {
3294
  return $this->get_data( 'last_name' );
3295
  }
3296
 
 
 
 
 
 
3297
  public function get_nickname() {
3298
  return $this->get_data( 'nickname' );
3299
  }
3300
 
 
 
 
 
 
3301
  public function get_display_name() {
3302
  return $this->get_data( 'display_name' );
3303
  }
3304
- /** Getter/Setter functions */
3305
  }
3306
-
3307
  }
344
  return $records;
345
  }
346
 
347
+ /**
348
+ * Count number of rows for an item in user-items
349
+ *
350
+ * @param int $item_id
351
+ * @param int $course_id
352
+ *
353
+ * @return int
354
+ */
355
+ public function count_item_archive( $item_id, $course_id = 0 ) {
356
+ $count = 0;
357
+
358
+ if ( $items = $this->get_item_archive( $item_id, $course_id ) ) {
359
+ $count = sizeof( $items );
360
+ }
361
+
362
+ return $count;
363
+ }
364
+
365
  /**
366
  * Start quiz for the user.
367
  *
399
  $course = learn_press_get_course( $course_id );
400
  $user = LP_Global::user();
401
 
402
+ if ( $course->is_required_enroll() && $user->is_guest() ) {
403
  throw new Exception( __( 'You have to login for starting quiz.', 'learnpress' ), LP_REQUIRE_LOGIN );
404
  }
405
 
543
  }
544
 
545
  protected function _insert_quiz_item( $quiz_id, $course_id ) {
546
+ $course_data = $this->get_course_data( $course_id );
547
+ $quiz = learn_press_get_quiz( $quiz_id );
548
+ $last_results = $this->get_item_archive( $quiz_id, $course_id, true );
549
+
550
+ if ( ! $quiz->enable_archive_history() ) {
551
+
552
+ if ( $last_results ) {
553
+ global $wpdb;
554
+ $query = $wpdb->prepare( "
555
+ DELETE FROM {$wpdb->learnpress_user_items}
556
+ WHERE user_id = %d AND item_id = %d AND user_item_id <> %d
557
+ ", $this->get_id(), $quiz_id, $last_results['user_item_id'] );
558
+
559
+ $wpdb->query( $query );
560
+ } else {
561
+ $course_data->update_item_retaken_count( $quiz_id, 0 );
562
+ }
563
+ //var_dump($last_results);
564
+ }
565
+
566
+ if ( $last_results && $last_results['status'] === 'completed' ) {
567
+ $course_data->update_item_retaken_count( $quiz_id, '+1' );
568
+ }
569
+ //die();
570
+ //// var_dump( $this->count_item_archive( $quiz_id, $course_id ) );
571
+ //// var_dump( $this->can_retake_quiz( $quiz_id, $course_id ) );
572
+ ////
573
+ //// var_dump( current_filter() );
574
+ //// var_dump( current_action() );
575
+ //
576
+ // die();
577
+ $start_time = new LP_Datetime( current_time( 'mysql' ) );
578
+ $item_data = array(
579
  'user_id' => $this->get_id(),
580
  'item_id' => $quiz_id,
581
  'start_time' => $start_time->toSql(),
592
 
593
  $last_results = $this->get_item_archive( $quiz_id, $course_id, true );
594
  $set_current_question = false;
595
+
596
  // If there is no a record
597
  if ( ! $last_results ) {
598
  $item_data = apply_filters( 'learn-press/insert-user-item-data', $item_data, $quiz_id, $course_id, $this->get_id() );
672
  }
673
 
674
  public function get_current_question_id( $quiz_id = 0 ) {
675
+
676
+ _deprecated_function( __CLASS__ . "::" . __FUNCTION__, '3.0.8' );
677
  $current = false;
678
  $quiz_current_question = $this->quiz_current_question;
679
  if ( is_array( $quiz_current_question ) && ! empty( $quiz_current_question[ $quiz_id ] ) ) {
974
  */
975
  public function get_current_question( $quiz_id, $course_id, $permalink = false ) {
976
  $data = $this->get_course_data( $course_id );
977
+
978
  if ( empty( $data[ $quiz_id ] ) ) {
979
  return false;
980
  }
1506
  return $posts;
1507
  }
1508
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1509
  /**
1510
  * Get all quizzes of the user
1511
  *
1535
  * @throws Exception
1536
  */
1537
  public function can( $role ) {
1538
+ _deprecated_function( __FUNCTION__, '3.0.8' );
1539
  $args = func_get_args();
1540
  unset( $args[0] );
1541
  $method = 'can_' . preg_replace( '!-!', '_', $role );
1550
  /**
1551
  * Return true if user can purchase a course
1552
  *
1553
+ * @param int $course_id
1554
  *
1555
  * @return bool
1556
  */
1559
  $purchasable = $course->is_purchasable();
1560
 
1561
  if ( $purchasable && $order = $this->has_ordered_course( $course_id ) ) {
 
 
 
1562
  }
1563
 
1564
  // @deprecated
1578
  public function can_enroll_course( $course_id ) {
1579
  $course = learn_press_get_course( $course_id );
1580
 
1581
+ // Course is published and not reached limitation
1582
+ $can_enroll = ! ! $course && $course->is_publish();// && $course->is_in_stock();
1583
 
1584
  if ( $can_enroll && $course->is_free() && ! $course->is_required_enroll() && ! $course->is_in_stock() ) {
1585
  $can_enroll = false;
1656
  $lesson = LP_Lesson::get_lesson( $lesson_id );
1657
 
1658
  if ( $course = learn_press_get_course( $course_id ) ) {
1659
+ if ( $this->has_enrolled_course( $course_id ) || $this->has_finished_course( $course_id ) ) {
1660
  // or user has enrolled course
1661
  $view = 'enrolled';
1662
  } elseif ( $lesson->is_preview() || $this->is_admin() || ( $this->is_instructor() && $course->get_instructor( 'id' ) == $this->get_id() ) ) {
1663
  $view = 'preview';
1664
+ } elseif ( ! $course->is_required_enroll() ) {
1665
  // if course is not required enroll so the lesson is previewable
1666
  $view = 'no-required-enroll';
1667
+ } elseif( ! $this->is_logged_in() ){
1668
+ $view = 'not-logged-in';
1669
+ } elseif( ! $this->has_enrolled_course( $course_id ) ){
1670
+ $view = 'not-enrolled';
1671
  }
1672
  }
1673
  }
1700
  }
1701
 
1702
  if ( $course ) {
1703
+ if ( $this->has_enrolled_course( $course_id ) || $this->has_finished_course( $course_id ) ) {
1704
  $view = 'enrolled';
1705
  } elseif ( $this->is_admin() || ( $this->is_instructor() && $course->get_instructor( 'id' ) == $this->get_id() ) ) {
1706
  $view = 'preview';
1707
+ } elseif ( ! $course->is_required_enroll() ) {
1708
  $view = 'no-required-enroll';
1709
  }
1710
  }
1722
  * - FALSE if user CAN NOT retake quiz
1723
  * - INT (number of remain) if user CAN retake quiz
1724
  *
1725
+ * @param int $quiz_id
1726
+ * @param int $course_id
1727
  *
1728
+ * @return bool|int
1729
  */
1730
  public function can_retake_quiz( $quiz_id, $course_id = 0 ) {
1731
  $can = false;
1732
  $course = learn_press_get_course( $course_id );
1733
+
1734
  if ( $course && $course->has_item( $quiz_id ) ) {
1735
+
1736
  // Check if quiz is already exists
1737
  if ( $quiz = learn_press_get_quiz( $quiz_id ) ) {
1738
  $count = $quiz->get_retake_count();
1744
  } else {
1745
  $can = $count;
1746
  }
1747
+
1748
+ $can = absint( $can );
1749
  }
1750
  }
1751
  }
1752
 
 
1753
  return apply_filters( 'learn_press_user_can_retake_quiz', $can, $quiz_id, $this->get_id(), $course_id );
1754
  }
1755
 
1849
  public function finish_course( $course_id ) {
1850
  $return = false;
1851
  if ( $course = learn_press_get_course( $course_id ) ) {
1852
+ if ( ! $this->can_finish_course( $course_id ) ) {
1853
  return false;
1854
  } else {
1855
  $user_course = $this->get_course_data( $course_id );
1888
  }
1889
 
1890
  public function has( $role ) {
1891
+ _deprecated_function( __FUNCTION__, '3.0.8' );
1892
+
1893
  $args = func_get_args();
1894
  unset( $args[0] );
1895
  $method = 'has_' . preg_replace( '!-!', '_', $role );
1953
  * @return bool
1954
  */
1955
  public function has_enrolled_course( $course_id, $force = false ) {
1956
+ $enrolled = 'no';
1957
+ $cache_key = 'course-' . $this->get_id() . '-' . $course_id;
1958
 
1959
+ if ( false === ( $enrolled = wp_cache_get( $cache_key, 'enrolled-courses' ) ) ) {
1960
+ // No new order is pending and has already enrolled or finished course
1961
+ if ( 'lp-pending' !== $this->get_order_status( $course_id ) ) {
1962
+ $enrolled = $this->has_course_status( $course_id, array(
1963
+ 'enrolled',
1964
+ 'finished'
1965
+ ) ) ? 'yes' : 'no';
1966
+ }
1967
+ wp_cache_set( $cache_key, $enrolled, 'enrolled-courses' );
1968
  }
1969
 
1970
+ $enrolled = $enrolled === 'yes' ? true : false;
1971
+
1972
+ // @deprecated
1973
  $enrolled = apply_filters( 'learn_press_user_has_enrolled_course', $enrolled, $this, $course_id );
1974
 
1975
  /**
2099
  * @return int
2100
  */
2101
  public function count_retaken_quiz( $quiz_id, $course_id = 0, $force = false ) {
2102
+ $count = false;
 
2103
  $course_id = $this->_get_course( $course_id );
2104
 
2105
  if ( ! $course_id || ! $quiz_id ) {
2106
  return $count;
2107
  }
2108
 
2109
+ $count = 0;
2110
+
2111
+ if ( $course_data = $this->get_course_data( $course_id ) ) {
2112
+
2113
+ if ( false === ( $count = $course_data->get_item_retaken_count( $quiz_id ) ) ) {
2114
+ //$items = $course_data->get_meta( '_retaken_items' );
2115
+
2116
+ //if ( false === $items || ! array_key_exists( $quiz_id, $items ) ) {
2117
+ //settype( $items, 'array' );
2118
+ $user_item = $this->get_item_data( $quiz_id, $course_id );
2119
+
2120
+ if ( $user_item ) {
2121
+ $new_count = $user_item->count_history() - 1;
2122
+ $count = $course_data->update_item_retaken_count( $quiz_id, $new_count );
2123
+ }
2124
+ //$items[ $quiz_id ] = $count;
2125
+ //$course_data->set_meta( '_retaken_items', $items );
2126
+ //$course_data->update_meta();
2127
+ ///}
2128
+
2129
+ //$count = $items[ $quiz_id ];
2130
+ }
2131
+
2132
  }
2133
 
2134
  return apply_filters( 'learn_press_user_count_retaken_quiz', $count, $quiz_id, $course_id, $this->get_id() );
2158
  }
2159
 
2160
  public function retake_course( $course_id ) {
2161
+ if ( ! $this->can_retake_course( $course_id ) ) {
2162
  return false;
2163
  }
2164
 
2388
  */
2389
  public function evaluate_quiz_results( $quiz_id, $progress ) {
2390
  _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '3.0.0' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2391
 
2392
+ return array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2393
  }
2394
 
2395
  /**
2459
  * @return mixed|void
2460
  */
2461
  public function has_completed_item( $item, $course_id = 0, $force = false ) {
2462
+
2463
  $course_id = $this->_get_course( $course_id );
2464
 
2465
  $return = false;
2627
  }
2628
  }
2629
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2630
  /**
2631
  * @param $question_id
2632
  *
2690
  return $answered ? array_key_exists( $question_id, $answered ) : false;
2691
  }
2692
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2693
  /**
2694
  * @param array $args
2695
  *
2699
  return $this->_curd->query_purchased_courses( $this->get_id(), $args );
2700
  }
2701
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2702
  /**
2703
  * @return array
2704
  */
2747
  return $quiz_data ? $quiz_data->has_hinted_question( $question_id ) : false;
2748
  }
2749
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2750
  /**
2751
  * Return TRUE if user is already exists.
2752
  *
2882
  public function can_do_quiz( $quiz_id, $course_id = 0 ) {
2883
  $course = learn_press_get_course( $course_id );
2884
  if ( $course->is_required_enroll() ) {
2885
+ $can = $this->has_course_status( $course_id, array( 'enrolled' ) ) && ! $this->has_started_quiz( $quiz_id, $course_id );
2886
  } else {
2887
+ $can = ! $this->has_started_quiz( $quiz_id, $course_id );
2888
  }
2889
 
2890
  return apply_filters( 'learn_press_user_can_do_quiz', $can, $quiz_id, $this->get_id(), $course_id );
2904
  *
2905
  * @param $course_id
2906
  *
2907
+ * @return string|bool
 
2908
  */
2909
  public function get_course_grade( $course_id ) {
2910
+ $grade = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2911
 
2912
+ if ( $course_data = $this->get_course_data( $course_id ) ) {
2913
+ $grade = $course_data->get_grade();
2914
+ }
2915
 
2916
+ return apply_filters( 'learn-press/user-course-grade', $grade, $this->get_id(), $course_id );
2917
  }
2918
 
2919
  /**
2925
  return ! $this->get_id() || ! get_user_by( 'id', $this->get_id() );
2926
  }
2927
 
2928
+ /**
2929
+ * Load course data for the user.
2930
+ *
2931
+ * @param mixed $the_course
2932
+ */
2933
  public function read_course( $the_course ) {
2934
  $this->_curd->read_course( $this->get_id(), $the_course );
2935
  }
2936
 
2937
+ /**
2938
+ * Check if user can edit a post.
2939
+ *
2940
+ * @param int $post_id
2941
+ *
2942
+ * @return bool
2943
+ */
2944
  public function can_edit( $post_id ) {
2945
  if ( $this->get_id() !== get_current_user_id() ) {
2946
  return false;
2956
  return $this->get_data( 'email' );
2957
  }
2958
 
2959
+ /**
2960
+ * Return user_login of the user.
2961
+ *
2962
+ * @return string
2963
+ */
2964
  public function get_username() {
2965
  return $this->get_data( 'user_login' );
2966
  }
2967
 
2968
+ /**
2969
+ * Return user bio information.
2970
+ *
2971
+ * @return string
2972
+ */
2973
  public function get_description() {
2974
  return $this->get_data( 'description' );
2975
  }
2976
 
2977
+ /**
2978
+ * Return user first name.
2979
+ *
2980
+ * @return string
2981
+ */
2982
  public function get_first_name() {
2983
  return $this->get_data( 'first_name' );
2984
  }
2985
 
2986
+ /**
2987
+ * Return user last name.
2988
+ *
2989
+ * @return string
2990
+ */
2991
  public function get_last_name() {
2992
  return $this->get_data( 'last_name' );
2993
  }
2994
 
2995
+ /**
2996
+ * Return user nickname.
2997
+ *
2998
+ * @return string
2999
+ */
3000
  public function get_nickname() {
3001
  return $this->get_data( 'nickname' );
3002
  }
3003
 
3004
+ /**
3005
+ * Return user display name.
3006
+ *
3007
+ * @return string
3008
+ */
3009
  public function get_display_name() {
3010
  return $this->get_data( 'display_name' );
3011
  }
 
3012
  }
 
3013
  }
inc/user/class-lp-profile.php CHANGED
@@ -378,6 +378,18 @@ if ( ! class_exists( 'LP_Profile' ) ) {
378
  * @return bool
379
  */
380
  public function is_enable_avatar() {
 
 
 
 
 
 
 
 
 
 
 
 
381
  return LP()->settings()->get( 'profile_avatar' ) === 'yes';
382
  }
383
 
@@ -385,7 +397,7 @@ if ( ! class_exists( 'LP_Profile' ) ) {
385
  * Get current tab slug in query string.
386
  *
387
  * @param string $default Optional.
388
- * @param bool $key Optional. True if return the key instead of value.
389
  *
390
  * @return string
391
  */
378
  * @return bool
379
  */
380
  public function is_enable_avatar() {
381
+ if ( ! $profile_avatar = get_option( 'learn_press_profile_avatar' ) ) {
382
+ update_option( 'learn_press_profile_avatar', 'yes' );
383
+ }
384
+ $settings = LP()->settings;
385
+ if ( ! $setting_avatar = $settings->get( 'profile_endpoints.settings-avatar' ) ) {
386
+ $profile_endpoints['settings-basic-information'] = 'basic-information';
387
+ $profile_endpoints['settings-avatar'] = 'avatar';
388
+ $profile_endpoints['settings-change-password'] = 'change-password';
389
+ update_option( 'learn_press_profile_endpoints', $profile_endpoints, 'yes' );
390
+ add_rewrite_rule( '(.?.+?)/avatar(/(.*))?/?$', 'index.php?pagename=$matches[1]&section=avatar', 'top' );
391
+ }
392
+
393
  return LP()->settings()->get( 'profile_avatar' ) === 'yes';
394
  }
395
 
397
  * Get current tab slug in query string.
398
  *
399
  * @param string $default Optional.
400
+ * @param bool $key Optional. True if return the key instead of value.
401
  *
402
  * @return string
403
  */
inc/user/class-lp-user-factory.php CHANGED
@@ -21,14 +21,14 @@ class LP_User_Factory {
21
  /**
22
  * @var LP_Background_Clear_Temp_Users
23
  */
24
- protected static $_background_clear_users = null;
25
 
26
  /**
27
  *
28
  */
29
  public static function init() {
30
- self::$_background_clear_users = new LP_Background_Clear_Temp_Users();
31
- self::$_guest_transient = WEEK_IN_SECONDS;
32
  add_action( 'wp_login', array( __CLASS__, 'clear_temp_user_data' ) );
33
  add_action( 'learn_press_user_start_quiz', array( __CLASS__, 'start_quiz' ), 10, 4 );
34
  add_action( 'learn_press_user_retake_quiz', array( __CLASS__, 'retake_quiz' ), 10, 4 );
@@ -36,7 +36,7 @@ class LP_User_Factory {
36
  add_action( 'learn_press_deactivate', array( __CLASS__, 'deregister_event' ), 15 );
37
  add_action( 'learn_press_schedule_cleanup_temp_users', array( __CLASS__, 'schedule_cleanup_temp_users' ) );
38
  add_filter( 'cron_schedules', array( __CLASS__, 'cron_schedules' ) );
39
- add_action( 'init', array( __CLASS__, 'clear_temp_users' ) );
40
 
41
  /**
42
  * Filters into wp users manager
@@ -50,7 +50,7 @@ class LP_User_Factory {
50
  public static function clear_temp_users() {
51
  global $wpdb;
52
  if ( $users = learn_press_get_temp_users() ) {
53
- self::$_background_clear_users->push_to_queue(
54
  array(
55
  'action' => 'clear_temp_users',
56
  'users' => $users
@@ -97,14 +97,14 @@ class LP_User_Factory {
97
  case 'pending':
98
  case 'processing':
99
  case 'cancelled':
100
- //self::_update_user_item_pending( $order, $new_status );
 
101
  break;
102
  case'completed':
103
  self::_update_user_item_purchased( $order, $old_status, $new_status );
104
  }
105
  //LP_Debug::commitTransaction();
106
- }
107
- catch ( Exception $ex ) {
108
  //LP_Debug::rollbackTransaction();
109
  }
110
  add_action( 'learn-press/order/status-changed', array( __CLASS__, 'update_user_items' ), 10, 3 );
@@ -112,8 +112,8 @@ class LP_User_Factory {
112
 
113
  /**
114
  * @param LP_Order $order
115
- * @param string $old_status
116
- * @param string $new_status
117
  */
118
  protected static function _update_user_item_pending( $order, $old_status, $new_status ) {
119
  $curd = new LP_User_CURD();
@@ -133,7 +133,7 @@ class LP_User_Factory {
133
  } else {
134
  $item_id = $item;
135
  }
136
- $curd->update_user_item_status( $item_id, 'pending' );
137
  }
138
  }
139
  }
@@ -141,8 +141,8 @@ class LP_User_Factory {
141
 
142
  /**
143
  * @param LP_Order $order
144
- * @param string $old_status
145
- * @param string $new_status
146
  */
147
  protected static function _update_user_item_purchased( $order, $old_status, $new_status ) {
148
  global $wpdb;
@@ -190,6 +190,9 @@ class LP_User_Factory {
190
  $item = $curd->get_user_item_by_id( $user_item_id );
191
  $last_status = $curd->get_user_item_meta( $user_item_id, '_last_status' );
192
  $args = array( 'status' => $last_status );
 
 
 
193
  if ( ! $last_status ) {
194
  if ( 'enrolled' == ( $args['status'] = LP()->settings->get( 'auto_enroll' ) == 'no' ? 'purchased' : 'enrolled' ) ) {
195
  $time = new LP_Datetime();
21
  /**
22
  * @var LP_Background_Clear_Temp_Users
23
  */
24
+ //protected static $_background_clear_users = null;
25
 
26
  /**
27
  *
28
  */
29
  public static function init() {
30
+ //self::$_background_clear_users = new LP_Background_Clear_Temp_Users();
31
+ self::$_guest_transient = WEEK_IN_SECONDS;
32
  add_action( 'wp_login', array( __CLASS__, 'clear_temp_user_data' ) );
33
  add_action( 'learn_press_user_start_quiz', array( __CLASS__, 'start_quiz' ), 10, 4 );
34
  add_action( 'learn_press_user_retake_quiz', array( __CLASS__, 'retake_quiz' ), 10, 4 );
36
  add_action( 'learn_press_deactivate', array( __CLASS__, 'deregister_event' ), 15 );
37
  add_action( 'learn_press_schedule_cleanup_temp_users', array( __CLASS__, 'schedule_cleanup_temp_users' ) );
38
  add_filter( 'cron_schedules', array( __CLASS__, 'cron_schedules' ) );
39
+ ///add_action( 'init', array( __CLASS__, 'clear_temp_users' ) );
40
 
41
  /**
42
  * Filters into wp users manager
50
  public static function clear_temp_users() {
51
  global $wpdb;
52
  if ( $users = learn_press_get_temp_users() ) {
53
+ LP()->background( 'clear-temp-users' )->push_to_queue(
54
  array(
55
  'action' => 'clear_temp_users',
56
  'users' => $users
97
  case 'pending':
98
  case 'processing':
99
  case 'cancelled':
100
+ case 'failed':
101
+ self::_update_user_item_pending( $order, $old_status, $new_status );
102
  break;
103
  case'completed':
104
  self::_update_user_item_purchased( $order, $old_status, $new_status );
105
  }
106
  //LP_Debug::commitTransaction();
107
+ } catch ( Exception $ex ) {
 
108
  //LP_Debug::rollbackTransaction();
109
  }
110
  add_action( 'learn-press/order/status-changed', array( __CLASS__, 'update_user_items' ), 10, 3 );
112
 
113
  /**
114
  * @param LP_Order $order
115
+ * @param string $old_status
116
+ * @param string $new_status
117
  */
118
  protected static function _update_user_item_pending( $order, $old_status, $new_status ) {
119
  $curd = new LP_User_CURD();
133
  } else {
134
  $item_id = $item;
135
  }
136
+ $curd->update_user_item_status( $item_id, $new_status );
137
  }
138
  }
139
  }
141
 
142
  /**
143
  * @param LP_Order $order
144
+ * @param string $old_status
145
+ * @param string $new_status
146
  */
147
  protected static function _update_user_item_purchased( $order, $old_status, $new_status ) {
148
  global $wpdb;
190
  $item = $curd->get_user_item_by_id( $user_item_id );
191
  $last_status = $curd->get_user_item_meta( $user_item_id, '_last_status' );
192
  $args = array( 'status' => $last_status );
193
+ if ( $new_status == 'completed' ) {
194
+ $args['status'] = 'enrolled';
195
+ }
196
  if ( ! $last_status ) {
197
  if ( 'enrolled' == ( $args['status'] = LP()->settings->get( 'auto_enroll' ) == 'no' ? 'purchased' : 'enrolled' ) ) {
198
  $time = new LP_Datetime();
inc/user/lp-user-functions.php CHANGED
@@ -22,15 +22,26 @@ function learn_press_delete_user_data( $user_id, $course_id = 0 ) {
22
  // TODO: Should be deleted user's order and order data???
23
 
24
  $query_args = array( $user_id );
 
25
  if ( $course_id ) {
26
  $query_args[] = $course_id;
27
  }
 
 
 
 
 
 
 
 
28
  // delete all courses user has enrolled
29
  $query = $wpdb->prepare( "
30
  DELETE FROM {$wpdb->prefix}learnpress_user_items
31
  WHERE user_id = %d
32
  " . ( $course_id ? " AND item_id = %d" : "" ) . "
33
  ", $query_args );
 
 
34
  @$wpdb->query( $query );
35
  }
36
 
@@ -109,9 +120,11 @@ if ( ! function_exists( 'learn_press_get_user' ) ) {
109
 
110
  global $pagenow;
111
 
112
- // Check if user is existing
113
- if ( ! get_user_by( 'id', $user_id ) && $current ) {
114
- $user_id = get_current_user_id();
 
 
115
  }
116
 
117
  if ( ! $user_id && isset( LP()->session ) ) {
@@ -141,83 +154,92 @@ if ( ! function_exists( 'learn_press_get_user' ) ) {
141
  /**
142
  * Add more 2 user roles teacher and student
143
  *
144
- * @access public
145
- * @return void
146
  */
147
  function learn_press_add_user_roles() {
148
 
149
  $settings = LP()->settings;
 
150
  /* translators: user role */
151
  _x( 'Instructor', 'User role' );
 
152
  add_role(
153
  LP_TEACHER_ROLE,
154
  'Instructor',
155
  array()
156
  );
 
157
  $course_cap = LP_COURSE_CPT . 's';
158
  $lesson_cap = LP_LESSON_CPT . 's';
159
  $order_cap = LP_ORDER_CPT . 's';
160
- // teacher
161
- $teacher = get_role( LP_TEACHER_ROLE );
162
- $teacher->add_cap( 'delete_published_' . $course_cap );
163
- $teacher->add_cap( 'edit_published_' . $course_cap );
164
- $teacher->add_cap( 'edit_' . $course_cap );
165
- $teacher->add_cap( 'delete_' . $course_cap );
166
- $teacher->add_cap( 'unfiltered_html' );
167
 
168
- $settings->get( 'required_review' );
 
 
 
 
 
 
169
 
170
- if ( $settings->get( 'required_review' ) == 'yes' ) {
171
- $teacher->remove_cap( 'publish_' . $course_cap );
172
- } else {
173
- $teacher->add_cap( 'publish_' . $course_cap );
174
- }
175
- //
176
 
 
 
 
 
 
177
 
178
- $teacher->add_cap( 'delete_published_' . $lesson_cap );
179
- $teacher->add_cap( 'edit_published_' . $lesson_cap );
180
- $teacher->add_cap( 'edit_' . $lesson_cap );
181
- $teacher->add_cap( 'delete_' . $lesson_cap );
182
- $teacher->add_cap( 'publish_' . $lesson_cap );
183
- $teacher->add_cap( 'upload_files' );
184
- $teacher->add_cap( 'read' );
185
- $teacher->add_cap( 'edit_posts' );
 
186
 
187
  // administrator
188
- $admin = get_role( 'administrator' );
189
- $admin->add_cap( 'delete_' . $course_cap );
190
- $admin->add_cap( 'delete_published_' . $course_cap );
191
- $admin->add_cap( 'edit_' . $course_cap );
192
- $admin->add_cap( 'edit_published_' . $course_cap );
193
- $admin->add_cap( 'publish_' . $course_cap );
194
- $admin->add_cap( 'delete_private_' . $course_cap );
195
- $admin->add_cap( 'edit_private_' . $course_cap );
196
- $admin->add_cap( 'delete_others_' . $course_cap );
197
- $admin->add_cap( 'edit_others_' . $course_cap );
198
-
199
- $admin->add_cap( 'delete_' . $lesson_cap );
200
- $admin->add_cap( 'delete_published_' . $lesson_cap );
201
- $admin->add_cap( 'edit_' . $lesson_cap );
202
- $admin->add_cap( 'edit_published_' . $lesson_cap );
203
- $admin->add_cap( 'publish_' . $lesson_cap );
204
- $admin->add_cap( 'delete_private_' . $lesson_cap );
205
- $admin->add_cap( 'edit_private_' . $lesson_cap );
206
- $admin->add_cap( 'delete_others_' . $lesson_cap );
207
- $admin->add_cap( 'edit_others_' . $lesson_cap );
208
-
209
- $admin->add_cap( 'delete_' . $order_cap );
210
- $admin->add_cap( 'delete_published_' . $order_cap );
211
- $admin->add_cap( 'edit_' . $order_cap );
212
- $admin->add_cap( 'edit_published_' . $order_cap );
213
- $admin->add_cap( 'publish_' . $order_cap );
214
- $admin->add_cap( 'delete_private_' . $order_cap );
215
- $admin->add_cap( 'edit_private_' . $order_cap );
216
- $admin->add_cap( 'delete_others_' . $order_cap );
217
- $admin->add_cap( 'edit_others_' . $order_cap );
 
218
  }
219
 
220
- add_action( 'learn_press_ready', 'learn_press_add_user_roles' );
 
 
 
 
 
 
 
221
  function learn_press_get_user_questions( $user_id = null, $args = array() ) {
222
  if ( ! $user_id ) {
223
  $user_id = get_current_user_id();
22
  // TODO: Should be deleted user's order and order data???
23
 
24
  $query_args = array( $user_id );
25
+
26
  if ( $course_id ) {
27
  $query_args[] = $course_id;
28
  }
29
+
30
+ $query = $wpdb->prepare( "
31
+ SELECT user_item_id
32
+ FROM {$wpdb->prefix}learnpress_user_items
33
+ WHERE user_id = %d
34
+ " . ( $course_id ? " AND item_id = %d" : "" ) . "
35
+ ", $query_args );
36
+
37
  // delete all courses user has enrolled
38
  $query = $wpdb->prepare( "
39
  DELETE FROM {$wpdb->prefix}learnpress_user_items
40
  WHERE user_id = %d
41
  " . ( $course_id ? " AND item_id = %d" : "" ) . "
42
  ", $query_args );
43
+
44
+
45
  @$wpdb->query( $query );
46
  }
47
 
120
 
121
  global $pagenow;
122
 
123
+ if ( $user_id != LP()->session->guest_user_id ) {
124
+ // Check if user is existing
125
+ if ( ! get_user_by( 'id', $user_id ) && $current ) {
126
+ $user_id = get_current_user_id();
127
+ }
128
  }
129
 
130
  if ( ! $user_id && isset( LP()->session ) ) {
154
  /**
155
  * Add more 2 user roles teacher and student
156
  *
 
 
157
  */
158
  function learn_press_add_user_roles() {
159
 
160
  $settings = LP()->settings;
161
+
162
  /* translators: user role */
163
  _x( 'Instructor', 'User role' );
164
+
165
  add_role(
166
  LP_TEACHER_ROLE,
167
  'Instructor',
168
  array()
169
  );
170
+
171
  $course_cap = LP_COURSE_CPT . 's';
172
  $lesson_cap = LP_LESSON_CPT . 's';
173
  $order_cap = LP_ORDER_CPT . 's';
 
 
 
 
 
 
 
174
 
175
+ // teacher
176
+ if ( $teacher = get_role( LP_TEACHER_ROLE ) ) {
177
+ $teacher->add_cap( 'delete_published_' . $course_cap );
178
+ $teacher->add_cap( 'edit_published_' . $course_cap );
179
+ $teacher->add_cap( 'edit_' . $course_cap );
180
+ $teacher->add_cap( 'delete_' . $course_cap );
181
+ $teacher->add_cap( 'unfiltered_html' );
182
 
183
+ $settings->get( 'required_review' );
 
 
 
 
 
184
 
185
+ if ( $settings->get( 'required_review' ) == 'yes' ) {
186
+ $teacher->remove_cap( 'publish_' . $course_cap );
187
+ } else {
188
+ $teacher->add_cap( 'publish_' . $course_cap );
189
+ }
190
 
191
+ $teacher->add_cap( 'delete_published_' . $lesson_cap );
192
+ $teacher->add_cap( 'edit_published_' . $lesson_cap );
193
+ $teacher->add_cap( 'edit_' . $lesson_cap );
194
+ $teacher->add_cap( 'delete_' . $lesson_cap );
195
+ $teacher->add_cap( 'publish_' . $lesson_cap );
196
+ $teacher->add_cap( 'upload_files' );
197
+ $teacher->add_cap( 'read' );
198
+ $teacher->add_cap( 'edit_posts' );
199
+ }
200
 
201
  // administrator
202
+ if ( $admin = get_role( 'administrator' ) ) {
203
+ $admin->add_cap( 'delete_' . $course_cap );
204
+ $admin->add_cap( 'delete_published_' . $course_cap );
205
+ $admin->add_cap( 'edit_' . $course_cap );
206
+ $admin->add_cap( 'edit_published_' . $course_cap );
207
+ $admin->add_cap( 'publish_' . $course_cap );
208
+ $admin->add_cap( 'delete_private_' . $course_cap );
209
+ $admin->add_cap( 'edit_private_' . $course_cap );
210
+ $admin->add_cap( 'delete_others_' . $course_cap );
211
+ $admin->add_cap( 'edit_others_' . $course_cap );
212
+
213
+ $admin->add_cap( 'delete_' . $lesson_cap );
214
+ $admin->add_cap( 'delete_published_' . $lesson_cap );
215
+ $admin->add_cap( 'edit_' . $lesson_cap );
216
+ $admin->add_cap( 'edit_published_' . $lesson_cap );
217
+ $admin->add_cap( 'publish_' . $lesson_cap );
218
+ $admin->add_cap( 'delete_private_' . $lesson_cap );
219
+ $admin->add_cap( 'edit_private_' . $lesson_cap );
220
+ $admin->add_cap( 'delete_others_' . $lesson_cap );
221
+ $admin->add_cap( 'edit_others_' . $lesson_cap );
222
+
223
+ $admin->add_cap( 'delete_' . $order_cap );
224
+ $admin->add_cap( 'delete_published_' . $order_cap );
225
+ $admin->add_cap( 'edit_' . $order_cap );
226
+ $admin->add_cap( 'edit_published_' . $order_cap );
227
+ $admin->add_cap( 'publish_' . $order_cap );
228
+ $admin->add_cap( 'delete_private_' . $order_cap );
229
+ $admin->add_cap( 'edit_private_' . $order_cap );
230
+ $admin->add_cap( 'delete_others_' . $order_cap );
231
+ $admin->add_cap( 'edit_others_' . $order_cap );
232
+ }
233
  }
234
 
235
+ add_action( 'init', 'learn_press_add_user_roles' );
236
+
237
+ /**
238
+ * @param null $user_id
239
+ * @param array $args
240
+ *
241
+ * @return mixed
242
+ */
243
  function learn_press_get_user_questions( $user_id = null, $args = array() ) {
244
  if ( ! $user_id ) {
245
  $user_id = get_current_user_id();
languages/learnpress.pot CHANGED
@@ -8,7 +8,7 @@ msgid ""
8
  msgstr ""
9
  "Project-Id-Version: Package Name\n"
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2018-04-11 09:01+0700\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,7 +18,7 @@ msgstr ""
18
  "Content-Transfer-Encoding: 8bit\n"
19
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
20
 
21
- #: learnpress.php:293
22
  #, php-format
23
  msgid ""
24
  "LearnPress plugin base directory must be <strong>learnpress/learnpres.php</"
@@ -26,8 +26,8 @@ msgid ""
26
  "operational (currently <strong>%s</strong>)"
27
  msgstr ""
28
 
29
- #: inc/abstract-settings.php:59
30
- #: inc/admin/settings/abstract-settings-page.php:48
31
  msgid "No setting available."
32
  msgstr ""
33
 
@@ -44,7 +44,7 @@ msgstr ""
44
  msgid "The order %s has been successfully recovered."
45
  msgstr ""
46
 
47
- #: inc/class-lp-ajax.php:246 inc/admin/class-lp-admin-ajax.php:854
48
  msgid "Profile picture upload failed"
49
  msgstr ""
50
 
@@ -155,18 +155,18 @@ msgstr ""
155
  msgid "Page %d"
156
  msgstr ""
157
 
158
- #: inc/class-lp-checkout.php:154 inc/class-lp-checkout.php:414
159
  msgid "Please enter your email."
160
  msgstr ""
161
 
162
- #: inc/class-lp-checkout.php:200
163
  #: inc/shortcodes/class-lp-shortcode-register-form.php:64
164
  #: inc/shortcodes/class-lp-shortcode-register-form.php:66
165
  #: templates/checkout/form-login.php:63
166
  msgid "Username"
167
  msgstr ""
168
 
169
- #: inc/class-lp-checkout.php:201
170
  #: inc/shortcodes/class-lp-shortcode-login-form.php:69
171
  #: inc/shortcodes/class-lp-shortcode-login-form.php:71
172
  #: inc/shortcodes/class-lp-shortcode-register-form.php:80
@@ -175,42 +175,42 @@ msgstr ""
175
  msgid "Password"
176
  msgstr ""
177
 
178
- #: inc/class-lp-checkout.php:257 inc/class-lp-checkout.php:266
179
- #: inc/class-lp-checkout.php:305
180
  #, php-format
181
  msgid "Error %d: Unable to create order. Please try again."
182
  msgstr ""
183
 
184
- #: inc/class-lp-checkout.php:299
185
  msgid "Item does not exist!"
186
  msgstr ""
187
 
188
- #: inc/class-lp-checkout.php:329
189
  msgid "Unable to checkout. Order creation failed."
190
  msgstr ""
191
 
192
- #: inc/class-lp-checkout.php:405
193
  msgid "Please enter username."
194
  msgstr ""
195
 
196
- #: inc/class-lp-checkout.php:409
197
  msgid "Please enter user password"
198
  msgstr ""
199
 
200
- #: inc/class-lp-checkout.php:491
201
  msgid "No payment method is selected"
202
  msgstr ""
203
 
204
- #: inc/class-lp-checkout.php:531 templates/checkout/empty-cart.php:19
205
  msgid "Your cart is currently empty."
206
  msgstr ""
207
 
208
- #: inc/class-lp-checkout.php:550
209
  #, php-format
210
  msgid "Item \"%s\" is not purchasable."
211
  msgstr ""
212
 
213
- #: inc/class-lp-emails.php:124 inc/class-lp-emails.php:131
214
  msgid "Cheatin&#8217; huh?"
215
  msgstr ""
216
 
@@ -260,55 +260,54 @@ msgstr ""
260
  msgid "Password must include at least one of these characters ~!@#$%^&*() !"
261
  msgstr ""
262
 
263
- #: inc/class-lp-install.php:473
264
  msgid ""
265
  "It seems like you have updated LearnPress from an older version and there "
266
  "are some outdated courses or data that need to be upgraded."
267
  msgstr ""
268
 
269
- #: inc/class-lp-install.php:474
270
  msgid "Do not ask again."
271
  msgstr ""
272
 
273
- #: inc/class-lp-install.php:474
274
  msgid "Ok"
275
  msgstr ""
276
 
277
- #: inc/class-lp-install.php:474 inc/lp-core-functions.php:2203
278
- #: inc/admin/class-lp-admin-ajax.php:651 inc/admin/class-lp-admin.php:214
279
- #: inc/custom-post-types/course.php:818 inc/order/class-lp-order.php:940
280
  #: templates/checkout/form-login.php:103
281
  msgid "Cancel"
282
  msgstr ""
283
 
284
- #: inc/class-lp-install.php:475
285
  #: inc/admin/views/tools/database/html-upgrade-database.php:17
286
  msgid "Upgrade now"
287
  msgstr ""
288
 
289
- #: inc/class-lp-install.php:475
290
  msgid "No, thank!"
291
  msgstr ""
292
 
293
- #: inc/class-lp-install.php:482
294
  msgid ""
295
  "LearnPress has been updated and the database needs to be upgraded before you "
296
  "can work with it. Please notify the site administrator."
297
  msgstr ""
298
 
299
- #: inc/class-lp-install.php:501
300
  msgid "Thank you for using LearnPress"
301
  msgstr ""
302
 
303
  #: inc/class-lp-multi-language.php:52
304
- #: inc/admin/meta-box/fields/list-emails.php:64
305
  #: inc/admin/sub-menus/class-lp-submenu-settings.php:14
306
- #: inc/admin/views/quiz/question-meta.php:13
307
- #: inc/custom-post-types/question.php:277 inc/user/class-lp-profile.php:325
308
  msgid "Settings"
309
  msgstr ""
310
 
311
- #: inc/class-lp-multi-language.php:53 inc/libraries/meta-box/inc/core.php:33
312
  msgid "Documentation"
313
  msgstr ""
314
 
@@ -327,7 +326,7 @@ msgstr ""
327
  msgid "Invalid question!"
328
  msgstr ""
329
 
330
- #: inc/class-lp-page-controller.php:390
331
  #, php-format
332
  msgid "The user %s is not available!"
333
  msgstr ""
@@ -349,7 +348,7 @@ msgstr ""
349
  msgid "You are in preview mode. Continue <a href=\"%s\">editing</a>?"
350
  msgstr ""
351
 
352
- #: inc/class-lp-query-list-table.php:28 inc/custom-post-types/course.php:211
353
  msgid "item"
354
  msgstr ""
355
 
@@ -386,25 +385,30 @@ msgstr ""
386
  msgid "Invalid action."
387
  msgstr ""
388
 
389
- #: inc/class-lp-request-handler.php:273 inc/cart/class-lp-cart.php:459
 
 
 
 
 
390
  msgid "Checkout page hasn't been setup"
391
  msgstr ""
392
 
393
- #: inc/class-lp-request-handler.php:296
394
- #: inc/course/lp-course-functions.php:1025
395
  msgid "Invalid request!"
396
  msgstr ""
397
 
398
- #: inc/class-lp-request-handler.php:314
399
  #, php-format
400
  msgid "Congrats! You have enrolled &quot;%s&quot"
401
  msgstr ""
402
 
403
- #: inc/class-lp-request-handler.php:340
404
  msgid "Checkout page hasn't been setup or page does not exists."
405
  msgstr ""
406
 
407
- #: inc/class-lp-request-handler.php:342
408
  msgid "Checkout error! Please contact with admin for getting more information."
409
  msgstr ""
410
 
@@ -448,15 +452,15 @@ msgstr ""
448
 
449
  #: inc/lp-core-functions.php:351 inc/lp-template-functions.php:2653
450
  #: inc/admin/settings/class-lp-settings-courses.php:150
451
- #: inc/course/lp-course-functions.php:531 inc/custom-post-types/lesson.php:181
452
  msgid "Lesson"
453
  msgstr ""
454
 
455
  #: inc/lp-core-functions.php:352 inc/lp-template-functions.php:2643
456
  #: inc/admin/settings/class-lp-settings-courses.php:157
457
- #: inc/course/lp-course-functions.php:532
458
- #: inc/custom-post-types/question.php:320 inc/custom-post-types/quiz.php:92
459
- #: templates/profile/tabs/quizzes.php:37
460
  msgid "Quiz"
461
  msgstr ""
462
 
@@ -1160,9 +1164,9 @@ msgid_plural "minutes"
1160
  msgstr[0] ""
1161
  msgstr[1] ""
1162
 
1163
- #: inc/lp-core-functions.php:1497 inc/admin/views/quiz/editor.php:26
1164
- #: inc/admin/views/tools/course/html-course.php:26
1165
- #: inc/admin/views/tools/course/html-user.php:26
1166
  msgid "Name"
1167
  msgstr ""
1168
 
@@ -1230,102 +1234,102 @@ msgstr ""
1230
  msgid "Your request has been sent! We will get back to you soon!"
1231
  msgstr ""
1232
 
1233
- #: inc/lp-core-functions.php:2202
1234
  msgid "OK"
1235
  msgstr ""
1236
 
1237
- #: inc/lp-core-functions.php:2204
1238
- #: inc/libraries/meta-box/inc/fields/checkbox.php:50
1239
  msgid "Yes"
1240
  msgstr ""
1241
 
1242
- #: inc/lp-core-functions.php:2205
1243
- #: inc/libraries/meta-box/inc/fields/checkbox.php:50
1244
  #: templates/content-quiz/intro.php:25
1245
  msgid "No"
1246
  msgstr ""
1247
 
1248
- #: inc/lp-core-functions.php:2450
1249
  #, php-format
1250
  msgid "Congrats! You've enrolled the course \"%s\"."
1251
  msgstr ""
1252
 
1253
- #: inc/lp-core-functions.php:2483
1254
  msgid "Cart"
1255
  msgstr ""
1256
 
1257
- #: inc/lp-core-functions.php:2487
1258
  msgid "Enable cart"
1259
  msgstr ""
1260
 
1261
- #: inc/lp-core-functions.php:2488
1262
  msgid "Check this option to enable user purchase multiple courses at one time."
1263
  msgstr ""
1264
 
1265
- #: inc/lp-core-functions.php:2494
1266
  msgid "Add to cart redirect"
1267
  msgstr ""
1268
 
1269
- #: inc/lp-core-functions.php:2495
1270
  msgid "Redirect to checkout immediately after adding course to cart."
1271
  msgstr ""
1272
 
1273
- #: inc/lp-core-functions.php:2501
1274
  msgid "AJAX add to cart"
1275
  msgstr ""
1276
 
1277
- #: inc/lp-core-functions.php:2502
1278
  msgid "Using AJAX to add course to cart."
1279
  msgstr ""
1280
 
1281
- #: inc/lp-core-functions.php:2508
1282
  msgid "Cart page"
1283
  msgstr ""
1284
 
1285
- #: inc/lp-core-functions.php:2646
1286
  msgid "Are you sure you want to cancel order?"
1287
  msgstr ""
1288
 
1289
- #: inc/lp-core-functions.php:2647
1290
  msgid "Cancel Order"
1291
  msgstr ""
1292
 
1293
- #: inc/lp-core-functions.php:2702 inc/course/lp-course-functions.php:925
1294
  #: inc/user/class-lp-profile.php:833 inc/user/class-lp-profile.php:867
1295
  #: inc/user-item/class-lp-user-item.php:344
1296
  msgid "Passed"
1297
  msgstr ""
1298
 
1299
- #: inc/lp-core-functions.php:2705 inc/course/lp-course-functions.php:928
1300
  #: inc/user/class-lp-profile.php:834 inc/user/class-lp-profile.php:868
1301
  #: inc/user-item/class-lp-user-item.php:345
1302
  msgid "Failed"
1303
  msgstr ""
1304
 
1305
- #: inc/lp-core-functions.php:2895
1306
  msgctxt "static-page-name"
1307
  msgid "Checkout"
1308
  msgstr ""
1309
 
1310
- #: inc/lp-core-functions.php:2896
1311
  msgctxt "static-page-name"
1312
  msgid "Courses"
1313
  msgstr ""
1314
 
1315
- #: inc/lp-core-functions.php:2897
1316
  msgctxt "static-page-name"
1317
  msgid "Profile"
1318
  msgstr ""
1319
 
1320
- #: inc/lp-core-functions.php:2898
1321
  msgctxt "static-page-name"
1322
  msgid "Become a Teacher"
1323
  msgstr ""
1324
 
1325
  #: inc/lp-deprecated.php:370 inc/lp-deprecated.php:402
1326
- #: inc/admin/lp-admin-actions.php:54 inc/admin/lp-admin-functions.php:818
1327
- #: inc/admin/lp-admin-functions.php:983 inc/admin/lp-admin-functions.php:1185
1328
- #: inc/admin/lp-admin-functions.php:2066
1329
  #: inc/admin/views/statistics/courses.php:27
1330
  #: inc/admin/views/statistics/courses.php:42
1331
  #: inc/admin/views/statistics/general.php:43
@@ -1345,7 +1349,7 @@ msgstr ""
1345
  msgid "Learning"
1346
  msgstr ""
1347
 
1348
- #: inc/lp-deprecated.php:372 inc/custom-post-types/order.php:711
1349
  #: inc/user/class-lp-profile.php:284
1350
  msgid "Purchased"
1351
  msgstr ""
@@ -1360,10 +1364,10 @@ msgstr ""
1360
  msgid "Owned"
1361
  msgstr ""
1362
 
1363
- #: inc/lp-deprecated.php:403 inc/course/lp-course-functions.php:931
 
1364
  #: inc/user-item/class-lp-user-item.php:339
1365
  #: inc/user-item/class-lp-user-item.php:340
1366
- #: inc/user-item/class-lp-user-item.php:341
1367
  msgid "In Progress"
1368
  msgstr ""
1369
 
@@ -1388,7 +1392,6 @@ msgstr ""
1388
  #: inc/emails/class-lp-email-enrolled-course-instructor.php:27
1389
  #: inc/emails/class-lp-email-finished-course-instructor.php:27
1390
  #: inc/emails/class-lp-email-new-order-instructor.php:26
1391
- #: inc/emails/_bk/class-lp-email-finished-course-instructor.php:26
1392
  #: templates/single-course/tabs/instructor.php:22
1393
  msgid "Instructor"
1394
  msgstr ""
@@ -1398,15 +1401,15 @@ msgid "Course Search Results"
1398
  msgstr ""
1399
 
1400
  #: inc/lp-template-functions.php:1304 inc/admin/class-lp-admin.php:276
1401
- #: inc/admin/lp-admin-actions.php:208
1402
  #: inc/admin/settings/class-lp-settings-courses.php:12
1403
- #: inc/admin/settings/class-lp-settings-profile.php:148
1404
- #: inc/admin/settings/class-lp-settings-profile.php:273
1405
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:21
1406
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:28
1407
  #: inc/admin/views/setup/steps/pages.php:22
1408
- #: inc/admin/views/tools/course/html-user.php:27
1409
- #: inc/custom-post-types/course.php:74 inc/custom-post-types/course.php:76
1410
  #: inc/user/class-lp-profile.php:299
1411
  msgid "Courses"
1412
  msgstr ""
@@ -1441,9 +1444,8 @@ msgstr ""
1441
  msgid "Final"
1442
  msgstr ""
1443
 
1444
- #: inc/lp-template-functions.php:2656 inc/course/lp-course-functions.php:827
1445
- #: inc/custom-post-types/abstract.php:514 inc/custom-post-types/lesson.php:314
1446
- #: inc/libraries/meta-box/inc/fields/oembed.php:79
1447
  #: templates/single-course/section/item-meta.php:25
1448
  msgid "Preview"
1449
  msgstr ""
@@ -1452,7 +1454,7 @@ msgstr ""
1452
  msgid "Fill out the form and send us your requesting."
1453
  msgstr ""
1454
 
1455
- #: inc/lp-template-functions.php:3199 inc/custom-post-types/quiz.php:388
1456
  #, php-format
1457
  msgid "%d question"
1458
  msgid_plural "%d questions"
@@ -1483,7 +1485,7 @@ msgctxt "duration"
1483
  msgid "%s sec"
1484
  msgstr ""
1485
 
1486
- #: inc/lp-template-functions.php:3225 inc/course/lp-course-functions.php:748
1487
  msgid "Edit this item"
1488
  msgstr ""
1489
 
@@ -1591,78 +1593,78 @@ msgid "The following these functions %s do not exists in %s"
1591
  msgstr ""
1592
 
1593
  #: inc/abstracts/abstract-shortcode-courses.php:142
1594
- #: inc/admin/views/tools/course/html-course.php:48
1595
  #: templates/content-archive-course.php:74
1596
  msgid "No course found."
1597
  msgstr ""
1598
 
1599
- #: inc/admin/class-lp-admin-ajax.php:175
1600
  msgid "Ops! ID not found"
1601
  msgstr ""
1602
 
1603
- #: inc/admin/class-lp-admin-ajax.php:204
1604
  msgid "Duplicate post fail, please try again"
1605
  msgstr ""
1606
 
1607
- #: inc/admin/class-lp-admin-ajax.php:354
1608
  msgid "Access denied"
1609
  msgstr ""
1610
 
1611
- #: inc/admin/class-lp-admin-ajax.php:366 inc/admin/class-lp-admin-ajax.php:412
1612
  #: templates/order/order-details.php:18
1613
  msgid "Invalid order"
1614
  msgstr ""
1615
 
1616
- #: inc/admin/class-lp-admin-ajax.php:400
1617
  msgid "Permission denied"
1618
  msgstr ""
1619
 
1620
- #: inc/admin/class-lp-admin-ajax.php:600 inc/admin/class-lp-admin-ajax.php:773
1621
  #: inc/admin/lp-admin-functions.php:253
1622
  msgid "Edit Page"
1623
  msgstr ""
1624
 
1625
- #: inc/admin/class-lp-admin-ajax.php:601 inc/admin/class-lp-admin-ajax.php:775
1626
  #: inc/admin/lp-admin-functions.php:255
1627
  msgid "View Page"
1628
  msgstr ""
1629
 
1630
- #: inc/admin/class-lp-admin-ajax.php:603
1631
  msgid "Error! Page creation failed. Please try again."
1632
  msgstr ""
1633
 
1634
- #: inc/admin/class-lp-admin-ajax.php:606
1635
  msgid "Empty page name!"
1636
  msgstr ""
1637
 
1638
- #: inc/admin/class-lp-admin-ajax.php:640
1639
  msgid "The required pages are successfully created."
1640
  msgstr ""
1641
 
1642
- #: inc/admin/class-lp-admin-ajax.php:650
1643
  msgid "Please try again."
1644
  msgstr ""
1645
 
1646
- #: inc/admin/class-lp-admin-ajax.php:676
1647
  msgid "Successfully import sample data."
1648
  msgstr ""
1649
 
1650
- #: inc/admin/class-lp-admin-ajax.php:676
1651
  msgid "View courses"
1652
  msgstr ""
1653
 
1654
- #: inc/admin/class-lp-admin-ajax.php:680
1655
  msgid "Failed to import sample data. Please try again."
1656
  msgstr ""
1657
 
1658
- #: inc/admin/class-lp-admin-ajax.php:684
1659
  msgid ""
1660
  "Unknown error when installing/activating Import/Export add-on. Please try "
1661
  "again!"
1662
  msgstr ""
1663
 
1664
- #: inc/admin/class-lp-admin-ajax.php:700 inc/admin/class-lp-admin-ajax.php:721
1665
- #: inc/admin/class-lp-admin-ajax.php:741
1666
  msgid "You do not have the permission to deactivate plugins on this site."
1667
  msgstr ""
1668
 
@@ -1721,10 +1723,9 @@ msgstr ""
1721
  msgid "Learning Management System"
1722
  msgstr ""
1723
 
1724
- #: inc/admin/class-lp-admin-menu.php:90 inc/admin/class-lp-admin-menu.php:141
1725
- #: inc/admin/class-lp-admin.php:93 inc/admin/class-lp-admin.php:101
1726
- #: inc/admin/lp-admin-functions.php:1565
1727
- #: inc/admin/settings/class-lp-settings-emails.php:150
1728
  msgid "LearnPress"
1729
  msgstr ""
1730
 
@@ -1744,7 +1745,7 @@ msgstr ""
1744
  msgid "Cart Page"
1745
  msgstr ""
1746
 
1747
- #: inc/admin/class-lp-admin.php:187 inc/admin/class-lp-admin.php:579
1748
  msgid "Checkout Page"
1749
  msgstr ""
1750
 
@@ -1837,7 +1838,7 @@ msgstr ""
1837
  msgid "User has accepted to become a teacher."
1838
  msgstr ""
1839
 
1840
- #: inc/admin/class-lp-admin.php:553
1841
  #, php-format
1842
  msgid ""
1843
  "LearnPress requires permalink option <strong>Post name</strong> is enabled. "
@@ -1845,16 +1846,16 @@ msgid ""
1845
  "properly."
1846
  msgstr ""
1847
 
1848
- #: inc/admin/class-lp-admin.php:575
1849
  msgid "Profile Page"
1850
  msgstr ""
1851
 
1852
- #: inc/admin/class-lp-admin.php:605
1853
  #, php-format
1854
  msgid "The following required page(s) are currently missing: %s."
1855
  msgstr ""
1856
 
1857
- #: inc/admin/class-lp-admin.php:606
1858
  #, php-format
1859
  msgid ""
1860
  "To ensure all functions work properly, please click <a class=\"button\" id="
@@ -1862,7 +1863,7 @@ msgid ""
1862
  "automatically."
1863
  msgstr ""
1864
 
1865
- #: inc/admin/class-lp-admin.php:656
1866
  #, php-format
1867
  msgid ""
1868
  "If you like <strong>LearnPress</strong> please leave us a %s&#9733;&#9733;"
@@ -1870,7 +1871,7 @@ msgid ""
1870
  "generous."
1871
  msgstr ""
1872
 
1873
- #: inc/admin/class-lp-admin.php:656
1874
  msgid "Thanks :)"
1875
  msgstr ""
1876
 
@@ -1891,16 +1892,16 @@ msgstr ""
1891
  #: inc/admin/views/meta-boxes/course/assigned.php:22
1892
  #: inc/admin/views/meta-boxes/quiz/assigned.php:28
1893
  #: inc/admin/views/meta-boxes/quiz/assigned.php:38
1894
- #: inc/custom-post-types/abstract.php:493
1895
- #: inc/custom-post-types/abstract.php:502 inc/custom-post-types/lesson.php:349
1896
- #: inc/custom-post-types/question.php:359 inc/custom-post-types/quiz.php:369
1897
- #: inc/order/class-lp-order.php:933
1898
  msgid "View"
1899
  msgstr ""
1900
 
1901
  #: inc/admin/class-lp-install-sample-data.php:132
1902
- #: inc/attributes/course.php:232 inc/custom-post-types/lesson.php:347
1903
- #: inc/custom-post-types/question.php:357 inc/custom-post-types/quiz.php:367
1904
  #: templates/content-lesson/no-content.php:22
1905
  msgid "Edit"
1906
  msgstr ""
@@ -1922,14 +1923,16 @@ msgstr ""
1922
 
1923
  #: inc/admin/class-lp-modal-search-items.php:58
1924
  #: inc/admin/class-lp-modal-search-users.php:49
1925
- #: inc/admin/views/course/modal-choose-items.php:95
1926
- #: inc/admin/views/quiz/modal-choose-items.php:87
1927
  msgid "Add"
1928
  msgstr ""
1929
 
1930
  #: inc/admin/class-lp-modal-search-items.php:59
1931
  #: inc/admin/class-lp-modal-search-users.php:50
1932
- #: inc/admin/views/meta-boxes/order/details.php:239
 
 
1933
  msgid "Close"
1934
  msgstr ""
1935
 
@@ -2040,7 +2043,7 @@ msgid "Last Updated:"
2040
  msgstr ""
2041
 
2042
  #: inc/admin/class-lp-plugin-install-list-table.php:455
2043
- #: inc/custom-post-types/order.php:779
2044
  #, php-format
2045
  msgid "%s ago"
2046
  msgstr ""
@@ -2070,11 +2073,11 @@ msgstr ""
2070
  msgid "<strong>Compatible</strong> with your version of WordPress"
2071
  msgstr ""
2072
 
2073
- #: inc/admin/class-lp-reset-data.php:68
2074
- msgid "Data deleted"
2075
  msgstr ""
2076
 
2077
- #: inc/admin/class-lp-reset-data.php:70
2078
  msgid "No data found"
2079
  msgstr ""
2080
 
@@ -2123,13 +2126,13 @@ msgstr ""
2123
  #: inc/admin/class-lp-setup-wizard.php:221
2124
  #: inc/admin/meta-box/fields/payment-order.php:29
2125
  #: inc/admin/views/setup/steps/payment.php:16
2126
- #: inc/custom-post-types/course.php:721
2127
  msgid "Payment"
2128
  msgstr ""
2129
 
2130
  #: inc/admin/class-lp-setup-wizard.php:225
2131
  #: inc/admin/settings/class-lp-settings-emails.php:26
2132
- #: inc/admin/settings/class-lp-settings-emails.php:155
2133
  msgid "Emails"
2134
  msgstr ""
2135
 
@@ -2149,15 +2152,6 @@ msgstr ""
2149
  msgid "Enter your Paypal email address to accept payment via Paypal."
2150
  msgstr ""
2151
 
2152
- #: inc/admin/class-lp-updater.php:43
2153
- #, php-format
2154
- msgid "<p>Updated version %s</p>"
2155
- msgstr ""
2156
-
2157
- #: inc/admin/class-lp-updater.php:60
2158
- msgid "Successfully updated your database."
2159
- msgstr ""
2160
-
2161
  #: inc/admin/class-lp-upgrader.php:12
2162
  msgid "Invalid Data provided."
2163
  msgstr ""
@@ -2223,44 +2217,44 @@ msgstr ""
2223
  msgid "Disabling Maintenance mode&#8230;"
2224
  msgstr ""
2225
 
2226
- #: inc/admin/lp-admin-actions.php:55
2227
  #: inc/admin/views/dashboard/plugin-status/html-results.php:31
2228
  msgid "Published"
2229
  msgstr ""
2230
 
2231
- #: inc/admin/lp-admin-actions.php:56
2232
  msgid "Private"
2233
  msgstr ""
2234
 
2235
- #: inc/admin/lp-admin-actions.php:57
2236
  msgid "Pending Review"
2237
  msgstr ""
2238
 
2239
- #: inc/admin/lp-admin-actions.php:58
2240
  msgid "Scheduled"
2241
  msgstr ""
2242
 
2243
- #: inc/admin/lp-admin-actions.php:59
2244
  msgid "Draft"
2245
  msgstr ""
2246
 
2247
- #: inc/admin/lp-admin-actions.php:60
2248
  msgid "Trash"
2249
  msgstr ""
2250
 
2251
- #: inc/admin/lp-admin-actions.php:138
2252
  msgid "LearnPress Plugin"
2253
  msgstr ""
2254
 
2255
- #: inc/admin/lp-admin-actions.php:142
2256
  msgid "LearnPress Status"
2257
  msgstr ""
2258
 
2259
- #: inc/admin/lp-admin-actions.php:214 inc/custom-post-types/course.php:1253
2260
  msgid "Categories"
2261
  msgstr ""
2262
 
2263
- #: inc/admin/lp-admin-actions.php:219 inc/custom-post-types/course.php:166
2264
  msgid "Tags"
2265
  msgstr ""
2266
 
@@ -2269,14 +2263,15 @@ msgid "Duplicate this course"
2269
  msgstr ""
2270
 
2271
  #: inc/admin/lp-admin-functions.php:44
2272
- #: inc/admin/meta-box/fields/course-permalink.php:39
2273
  #: inc/admin/sub-menus/class-lp-submenu-tools.php:22
2274
  #: inc/admin/views/settings/fields/course-permalink.php:31
2275
  #: inc/admin/views/statistics/orders.php:47
2276
- #: inc/custom-post-types/lesson.php:308 inc/custom-post-types/quiz.php:336
2277
  #: templates/checkout/review-order.php:32
2278
  #: templates/emails/order-items-table.php:57
2279
  #: templates/order/order-details.php:28 templates/profile/tabs/courses.php:32
 
2280
  #: templates/profile/tabs/courses/purchased.php:38
2281
  msgid "Course"
2282
  msgstr ""
@@ -2325,25 +2320,26 @@ msgstr ""
2325
  msgid "Minutes"
2326
  msgstr ""
2327
 
2328
- #: inc/admin/lp-admin-functions.php:374 inc/admin/lp-admin-functions.php:400
2329
  msgid "Plain text"
2330
  msgstr ""
2331
 
2332
- #: inc/admin/lp-admin-functions.php:375 inc/admin/lp-admin-functions.php:401
 
2333
  msgid "HTML"
2334
  msgstr ""
2335
 
2336
- #: inc/admin/lp-admin-functions.php:544
2337
  #: inc/admin/views/addons/html-loop-theme.php:51
2338
  msgid "Get it now"
2339
  msgstr ""
2340
 
2341
- #: inc/admin/lp-admin-functions.php:546
2342
  #: inc/admin/views/addons/html-loop-theme.php:53
2343
  msgid "View Demo"
2344
  msgstr ""
2345
 
2346
- #: inc/admin/lp-admin-functions.php:823
2347
  #: inc/admin/views/statistics/courses.php:9
2348
  #: inc/admin/views/statistics/general.php:9
2349
  #: inc/admin/views/statistics/orders.php:9
@@ -2352,102 +2348,102 @@ msgstr ""
2352
  msgid "Instructors"
2353
  msgstr ""
2354
 
2355
- #: inc/admin/lp-admin-functions.php:828
2356
  #: inc/admin/views/statistics/courses.php:8
2357
  #: inc/admin/views/statistics/general.php:8
2358
  #: inc/admin/views/statistics/orders.php:8
2359
  #: inc/admin/views/statistics/users.php:8
2360
  #: inc/admin/views/statistics/users.php:47
2361
- #: inc/admin/views/tools/course/html-course.php:27
2362
- #: inc/custom-post-types/course.php:1242 inc/custom-post-types/course.php:1249
2363
  msgid "Students"
2364
  msgstr ""
2365
 
2366
- #: inc/admin/lp-admin-functions.php:988 inc/admin/lp-admin-functions.php:2071
2367
  #: inc/admin/views/meta-boxes/course/review-logs.php:25
2368
  #: inc/user/class-lp-profile.php:800
2369
  msgid "Publish"
2370
  msgstr ""
2371
 
2372
- #: inc/admin/lp-admin-functions.php:993 inc/admin/lp-admin-functions.php:1195
2373
- #: inc/admin/lp-admin-functions.php:2076
2374
  #: inc/admin/views/statistics/courses.php:44
2375
  #: inc/admin/views/statistics/general.php:61
2376
  #: inc/admin/views/statistics/orders.php:64 inc/user/class-lp-profile.php:801
2377
  msgid "Pending"
2378
  msgstr ""
2379
 
2380
- #: inc/admin/lp-admin-functions.php:998 inc/admin/lp-admin-functions.php:2081
2381
  #: inc/admin/views/statistics/courses.php:45
2382
  #: inc/admin/views/statistics/general.php:62
2383
  msgid "Paid"
2384
  msgstr ""
2385
 
2386
- #: inc/admin/lp-admin-functions.php:1003 inc/admin/lp-admin-functions.php:2086
2387
  #: inc/admin/views/statistics/courses.php:46
2388
  #: inc/admin/views/statistics/general.php:63
2389
- #: inc/course/abstract-course.php:719 inc/custom-post-types/course.php:1330
2390
  msgid "Free"
2391
  msgstr ""
2392
 
2393
- #: inc/admin/lp-admin-functions.php:1190
2394
  #: inc/admin/views/statistics/orders.php:63
2395
  #: inc/user-item/class-lp-user-item.php:342
2396
  #: templates/content-lesson/button-complete.php:36
2397
  msgid "Completed"
2398
  msgstr ""
2399
 
2400
- #: inc/admin/lp-admin-functions.php:1222
2401
  msgid "Pending Courses / Publish Courses"
2402
  msgstr ""
2403
 
2404
- #: inc/admin/lp-admin-functions.php:1223
2405
  msgid "Free Courses / Priced Courses"
2406
  msgstr ""
2407
 
2408
- #: inc/admin/lp-admin-functions.php:1391
2409
  msgid "Installed"
2410
  msgstr ""
2411
 
2412
- #: inc/admin/lp-admin-functions.php:1424
2413
  #, php-format
2414
  msgid "The user %s has become a teacher"
2415
  msgstr ""
2416
 
2417
- #: inc/admin/lp-admin-functions.php:1482
2418
  msgid "You haven't got any courses yet! Would you like to import sample data?"
2419
  msgstr ""
2420
 
2421
- #: inc/admin/lp-admin-functions.php:1483
2422
  msgid "If yes, please install add-on name"
2423
  msgstr ""
2424
 
2425
- #: inc/admin/lp-admin-functions.php:1484
2426
  msgid "LearnPress Import/Export"
2427
  msgstr ""
2428
 
2429
- #: inc/admin/lp-admin-functions.php:1485
2430
  msgid "but don't worry because it is completely automated."
2431
  msgstr ""
2432
 
2433
- #: inc/admin/lp-admin-functions.php:1486
2434
  msgid "Import now"
2435
  msgstr ""
2436
 
2437
- #: inc/admin/lp-admin-functions.php:1487
2438
  msgid "No, thanks!"
2439
  msgstr ""
2440
 
2441
- #: inc/admin/lp-admin-functions.php:1697
2442
  msgid " Copy"
2443
  msgstr ""
2444
 
2445
- #: inc/admin/lp-admin-functions.php:1790
2446
  #, php-format
2447
  msgid "Question id %s does not exist."
2448
  msgstr ""
2449
 
2450
- #: inc/admin/lp-admin-functions.php:1793
2451
  #, php-format
2452
  msgid "Quiz id %s does not exist."
2453
  msgstr ""
@@ -2472,7 +2468,7 @@ msgid "New Quiz"
2472
  msgstr ""
2473
 
2474
  #: inc/admin/editor/class-lp-admin-editor-quiz.php:150
2475
- #: inc/admin/editor/class-lp-admin-editor-quiz.php:567
2476
  msgid "Quiz creation failed."
2477
  msgstr ""
2478
 
@@ -2517,9 +2513,7 @@ msgstr ""
2517
 
2518
  #: inc/admin/meta-box/fields/color-schema.php:101
2519
  #: inc/admin/sub-menus/class-lp-submenu-settings.php:100
2520
- #: inc/admin/views/tools/course/html-course.php:38
2521
  #: inc/admin/views/tools/course/html-user-item.php:28
2522
- #: inc/admin/views/tools/course/html-user.php:40
2523
  #: inc/widgets/course-filters/tmpl/default.php:85
2524
  msgid "Reset"
2525
  msgstr ""
@@ -2536,47 +2530,58 @@ msgstr ""
2536
  msgid "Delete"
2537
  msgstr ""
2538
 
2539
- #: inc/admin/meta-box/fields/course-permalink.php:22
2540
- #: inc/admin/settings/class-lp-settings-courses.php:39
2541
  #: inc/admin/views/settings/fields/course-permalink.php:14
2542
  msgctxt "default-slug"
2543
  msgid "courses"
2544
  msgstr ""
2545
 
2546
- #: inc/admin/meta-box/fields/course-permalink.php:23
2547
  #: inc/admin/views/settings/fields/course-permalink.php:15
2548
  msgctxt "default-slug"
2549
  msgid "course"
2550
  msgstr ""
2551
 
2552
- #: inc/admin/meta-box/fields/course-permalink.php:34
2553
  #: inc/admin/views/settings/fields/course-permalink.php:26
2554
  msgid "Default"
2555
  msgstr ""
2556
 
2557
- #: inc/admin/meta-box/fields/course-permalink.php:44
2558
  #: inc/admin/views/settings/fields/course-permalink.php:36
2559
  msgid "Courses base"
2560
  msgstr ""
2561
 
2562
- #: inc/admin/meta-box/fields/course-permalink.php:49
2563
  #: inc/admin/views/settings/fields/course-permalink.php:41
2564
  msgid "Courses base with category"
2565
  msgstr ""
2566
 
2567
- #: inc/admin/meta-box/fields/course-permalink.php:84
2568
  #: inc/admin/views/settings/fields/course-permalink.php:77
2569
  msgid "Custom Base"
2570
  msgstr ""
2571
 
2572
- #: inc/admin/meta-box/fields/course-permalink.php:92
2573
  #: inc/admin/views/settings/fields/course-permalink.php:84
2574
  msgid ""
2575
  "Enter a custom base to use. A base <strong>must</strong> be set or WordPress "
2576
  "will use default values instead."
2577
  msgstr ""
2578
 
2579
- #: inc/admin/meta-box/fields/email-content.php:113
 
 
 
 
 
 
 
 
 
 
 
2580
  #: inc/admin/views/settings/emails/email-template.php:52
2581
  #, php-format
2582
  msgid ""
@@ -2584,7 +2589,7 @@ msgid ""
2584
  "%s</code>. <br />Please open the file in an editor program to edit"
2585
  msgstr ""
2586
 
2587
- #: inc/admin/meta-box/fields/email-content.php:149
2588
  #: inc/admin/views/settings/emails/email-template.php:77
2589
  msgid "Click on variables to add it into email content."
2590
  msgstr ""
@@ -2619,30 +2624,30 @@ msgstr ""
2619
  #: inc/admin/meta-box/fields/list-emails.php:30
2620
  #: inc/admin/meta-box/fields/payment-order.php:32
2621
  #: inc/admin/views/meta-boxes/order/details.php:58
2622
- #: inc/custom-post-types/order.php:714
2623
  #: templates/emails/order-items-table.php:44
2624
  #: templates/emails/plain/order-items-table.php:30
2625
  #: templates/profile/tabs/orders/list.php:34
2626
  msgid "Status"
2627
  msgstr ""
2628
 
2629
- #: inc/admin/meta-box/fields/list-emails.php:71
2630
  msgid ""
2631
  "You can enable/disable each email by clicking on the status icon or apply "
2632
  "status for all emails by clicking these buttons"
2633
  msgstr ""
2634
 
2635
- #: inc/admin/meta-box/fields/list-emails.php:74
2636
  msgid "Enable all"
2637
  msgstr ""
2638
 
2639
- #: inc/admin/meta-box/fields/list-emails.php:77
2640
  msgid "Disable all"
2641
  msgstr ""
2642
 
2643
  #: inc/admin/meta-box/fields/payment-order.php:30
2644
- #: inc/admin/views/tools/course/html-course.php:25
2645
- #: inc/admin/views/tools/course/html-user.php:25
2646
  msgid "ID"
2647
  msgstr ""
2648
 
@@ -2724,9 +2729,9 @@ msgstr ""
2724
  #: inc/admin/settings/class-lp-settings-general.php:16
2725
  #: inc/admin/settings/class-lp-settings-general.php:40
2726
  #: inc/admin/settings/class-lp-settings-payments.php:55
2727
- #: inc/admin/settings/class-lp-settings-profile.php:53
2728
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:26
2729
- #: inc/custom-post-types/course.php:532 inc/user/class-lp-profile.php:330
2730
  msgid "General"
2731
  msgstr ""
2732
 
@@ -2750,14 +2755,14 @@ msgid "Checkout Endpoints"
2750
  msgstr ""
2751
 
2752
  #: inc/admin/settings/class-lp-settings-courses.php:24
2753
- #: inc/custom-post-types/course.php:87
2754
  msgctxt "slug"
2755
  msgid "courses"
2756
  msgstr ""
2757
 
2758
  #: inc/admin/settings/class-lp-settings-courses.php:68
2759
  #: inc/admin/settings/class-lp-settings-general.php:42
2760
- #: inc/admin/settings/class-lp-settings-profile.php:55
2761
  msgid "General settings."
2762
  msgstr ""
2763
 
@@ -2793,8 +2798,8 @@ msgid "Courses Page"
2793
  msgstr ""
2794
 
2795
  #: inc/admin/settings/class-lp-settings-courses.php:110
2796
- #: inc/admin/settings/class-lp-settings-profile.php:108
2797
- msgid "Courses limit"
2798
  msgstr ""
2799
 
2800
  #: inc/admin/settings/class-lp-settings-courses.php:111
@@ -2802,7 +2807,6 @@ msgid "Number of courses displayed per page."
2802
  msgstr ""
2803
 
2804
  #: inc/admin/settings/class-lp-settings-courses.php:126
2805
- #: inc/admin/settings/class-lp-settings-courses.php:180
2806
  msgid "Single course"
2807
  msgstr ""
2808
 
@@ -2839,20 +2843,18 @@ msgstr ""
2839
  msgid "Thumbnail generation for archive/single course."
2840
  msgstr ""
2841
 
2842
- #: inc/admin/settings/class-lp-settings-courses.php:184
 
 
 
2843
  #: inc/admin/settings/class-lp-settings-courses.php:206
2844
  msgid "Turn on/off courses extra thumbnail."
2845
  msgstr ""
2846
 
2847
- #: inc/admin/settings/class-lp-settings-courses.php:187
2848
  #: inc/admin/settings/class-lp-settings-courses.php:209
2849
  msgid "Thumbnail dimensions"
2850
  msgstr ""
2851
 
2852
- #: inc/admin/settings/class-lp-settings-courses.php:202
2853
- msgid "Archive course"
2854
- msgstr ""
2855
-
2856
  #: inc/admin/settings/class-lp-settings-emails.php:64
2857
  msgid "General options"
2858
  msgstr ""
@@ -2889,21 +2891,35 @@ msgid "Email template"
2889
  msgstr ""
2890
 
2891
  #: inc/admin/settings/class-lp-settings-emails.php:140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2892
  #: inc/admin/views/settings/emails/general.php:40
2893
  msgid "Header image"
2894
  msgstr ""
2895
 
2896
- #: inc/admin/settings/class-lp-settings-emails.php:145
2897
  #: inc/admin/views/settings/emails/general.php:43
2898
  msgid "The image will be displayed in the top of the email."
2899
  msgstr ""
2900
 
2901
- #: inc/admin/settings/class-lp-settings-emails.php:148
2902
  #: inc/admin/views/settings/emails/general.php:47
2903
  msgid "Footer text"
2904
  msgstr ""
2905
 
2906
- #: inc/admin/settings/class-lp-settings-emails.php:152
2907
  msgid "The texts display in the bottom of email."
2908
  msgstr ""
2909
 
@@ -3013,179 +3029,179 @@ msgstr ""
3013
  msgid "Payment order"
3014
  msgstr ""
3015
 
3016
- #: inc/admin/settings/class-lp-settings-profile.php:58
3017
  msgid "Profile page"
3018
  msgstr ""
3019
 
3020
- #: inc/admin/settings/class-lp-settings-profile.php:64
3021
  msgid "Add link to admin bar"
3022
  msgstr ""
3023
 
3024
- #: inc/admin/settings/class-lp-settings-profile.php:70
3025
  msgid "Text link"
3026
  msgstr ""
3027
 
3028
- #: inc/admin/settings/class-lp-settings-profile.php:75
3029
  msgid "If empty, please enter the name of the page used for profile."
3030
  msgstr ""
3031
 
3032
- #: inc/admin/settings/class-lp-settings-profile.php:88
3033
  msgid "Target link"
3034
  msgstr ""
3035
 
3036
- #: inc/admin/settings/class-lp-settings-profile.php:93
3037
  msgid "Open in same the window"
3038
  msgstr ""
3039
 
3040
- #: inc/admin/settings/class-lp-settings-profile.php:94
3041
  msgid "Open in a new window"
3042
  msgstr ""
3043
 
3044
- #: inc/admin/settings/class-lp-settings-profile.php:113
3045
  msgid "Number of courses displayed per page in profile."
3046
  msgstr ""
3047
 
3048
- #: inc/admin/settings/class-lp-settings-profile.php:116
3049
  msgid "Enable login form"
3050
  msgstr ""
3051
 
3052
- #: inc/admin/settings/class-lp-settings-profile.php:120
3053
  msgid "Enable login from profile if the user is not logged in."
3054
  msgstr ""
3055
 
3056
- #: inc/admin/settings/class-lp-settings-profile.php:123
3057
  msgid "Enable register form"
3058
  msgstr ""
3059
 
3060
- #: inc/admin/settings/class-lp-settings-profile.php:127
3061
  msgid "Enable register from profile if the user is not logged in."
3062
  msgstr ""
3063
 
3064
- #: inc/admin/settings/class-lp-settings-profile.php:135
3065
- msgid "Sub tab slugs"
3066
  msgstr ""
3067
 
3068
- #: inc/admin/settings/class-lp-settings-profile.php:137
3069
  msgid "The slugs of tabs display in profile page. Each tab should be unique."
3070
  msgstr ""
3071
 
3072
- #: inc/admin/settings/class-lp-settings-profile.php:140
3073
  #: inc/admin/views/updates/0.9/step-upgraded.php:16
3074
  #: inc/user/class-lp-profile.php:293
3075
  msgid "Dashboard"
3076
  msgstr ""
3077
 
3078
- #: inc/admin/settings/class-lp-settings-profile.php:145
3079
- #: inc/admin/settings/class-lp-settings-profile.php:153
3080
- #: inc/admin/settings/class-lp-settings-profile.php:161
3081
- #: inc/admin/settings/class-lp-settings-profile.php:169
3082
- #: inc/admin/settings/class-lp-settings-profile.php:177
3083
- #: inc/admin/settings/class-lp-settings-profile.php:196
3084
- #: inc/admin/settings/class-lp-settings-profile.php:204
3085
- #: inc/admin/settings/class-lp-settings-profile.php:212
3086
- #: inc/admin/settings/class-lp-settings-profile.php:220
3087
  #, php-format
3088
  msgid "Example link is %s"
3089
  msgstr ""
3090
 
3091
- #: inc/admin/settings/class-lp-settings-profile.php:156
3092
- #: inc/admin/settings/class-lp-settings-profile.php:290
3093
  #: inc/custom-post-types/quiz.php:90 inc/custom-post-types/quiz.php:91
3094
  #: inc/custom-post-types/quiz.php:95 inc/user/class-lp-profile.php:306
3095
  #: templates/widgets/course-info/default.php:34
3096
  msgid "Quizzes"
3097
  msgstr ""
3098
 
3099
- #: inc/admin/settings/class-lp-settings-profile.php:164
3100
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:22
3101
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:29
3102
- #: inc/custom-post-types/order.php:842 inc/custom-post-types/order.php:843
3103
- #: inc/custom-post-types/order.php:847 inc/user/class-lp-profile.php:312
3104
  msgid "Orders"
3105
  msgstr ""
3106
 
3107
- #: inc/admin/settings/class-lp-settings-profile.php:172
3108
  #: inc/admin/views/meta-boxes/order/details.php:37
3109
  #: inc/user/class-lp-profile.php:318
3110
  msgid "Order details"
3111
  msgstr ""
3112
 
3113
- #: inc/admin/settings/class-lp-settings-profile.php:186
3114
  msgid "Settings Tab"
3115
  msgstr ""
3116
 
3117
- #: inc/admin/settings/class-lp-settings-profile.php:188
3118
  msgid "The slugs of sections in settings tab. Each slugs should be unique."
3119
  msgstr ""
3120
 
3121
- #: inc/admin/settings/class-lp-settings-profile.php:191
3122
  msgid "Slug"
3123
  msgstr ""
3124
 
3125
- #: inc/admin/settings/class-lp-settings-profile.php:199
3126
  msgid "Basic Information"
3127
  msgstr ""
3128
 
3129
- #: inc/admin/settings/class-lp-settings-profile.php:207
3130
- #: inc/admin/settings/class-lp-settings-profile.php:228
3131
  #: inc/user/class-lp-profile.php:348
3132
  msgid "Avatar"
3133
  msgstr ""
3134
 
3135
- #: inc/admin/settings/class-lp-settings-profile.php:215
3136
  msgid "Change Password"
3137
  msgstr ""
3138
 
3139
- #: inc/admin/settings/class-lp-settings-profile.php:230
3140
  msgid "User avatar settings."
3141
  msgstr ""
3142
 
3143
- #: inc/admin/settings/class-lp-settings-profile.php:233
3144
  msgid "Enable custom avatar"
3145
  msgstr ""
3146
 
3147
- #: inc/admin/settings/class-lp-settings-profile.php:239
3148
  msgid "Size"
3149
  msgstr ""
3150
 
3151
- #: inc/admin/settings/class-lp-settings-profile.php:253
3152
  msgid "The height and width of avatar should be equal."
3153
  msgstr ""
3154
 
3155
- #: inc/admin/settings/class-lp-settings-profile.php:261
3156
  #: inc/user/class-lp-profile.php:357
3157
  msgid "Publicity"
3158
  msgstr ""
3159
 
3160
- #: inc/admin/settings/class-lp-settings-profile.php:263
3161
  msgid "Publicity and sharing user profile content."
3162
  msgstr ""
3163
 
3164
- #: inc/admin/settings/class-lp-settings-profile.php:266
3165
  #: templates/profile/tabs/settings/publicity.php:38
3166
  msgid "My dashboard"
3167
  msgstr ""
3168
 
3169
- #: inc/admin/settings/class-lp-settings-profile.php:270
3170
  #: templates/profile/tabs/settings/publicity.php:43
3171
  msgid ""
3172
  "Public user profile content, if this option is turn off then other sections "
3173
  "in profile also become invisible."
3174
  msgstr ""
3175
 
3176
- #: inc/admin/settings/class-lp-settings-profile.php:277
3177
  msgid "Public user profile courses."
3178
  msgstr ""
3179
 
3180
- #: inc/admin/settings/class-lp-settings-profile.php:277
3181
  msgid "Allow user to turn on/off sharing profile course option"
3182
  msgstr ""
3183
 
3184
- #: inc/admin/settings/class-lp-settings-profile.php:294
3185
  msgid "Public user profile quizzes."
3186
  msgstr ""
3187
 
3188
- #: inc/admin/settings/class-lp-settings-profile.php:294
3189
  msgid "Allow user to turn on/off sharing profile quizzes option"
3190
  msgstr ""
3191
 
@@ -3361,28 +3377,27 @@ msgstr ""
3361
  msgid "Other"
3362
  msgstr ""
3363
 
3364
- #: inc/admin/views/course/editor.php:37
3365
  msgid "Something went wrong! Please reload to continue editing curriculum."
3366
  msgstr ""
3367
 
3368
- #: inc/admin/views/course/modal-choose-items.php:54
3369
  #: inc/admin/views/quiz/modal-choose-items.php:52
3370
- #: inc/custom-post-types/course.php:214 inc/custom-post-types/quiz.php:177
3371
  msgid "Selected items"
3372
  msgstr ""
3373
 
3374
- #: inc/admin/views/course/modal-choose-items.php:72
3375
- #: inc/admin/views/quiz/modal-choose-items.php:64
3376
  msgid "Type here to search item"
3377
  msgstr ""
3378
 
3379
- #: inc/admin/views/course/modal-choose-items.php:78
3380
- #: inc/admin/views/quiz/modal-choose-items.php:69
3381
  msgid "No item found."
3382
  msgstr ""
3383
 
3384
- #: inc/admin/views/course/modal-choose-items.php:96
3385
- #: inc/admin/views/quiz/modal-choose-items.php:88
3386
  msgid "Adding"
3387
  msgstr ""
3388
 
@@ -3402,28 +3417,28 @@ msgctxt "page-navigation"
3402
  msgid "Next"
3403
  msgstr ""
3404
 
3405
- #: inc/admin/views/course/section-item.php:36
3406
  msgid "Remove from course"
3407
  msgstr ""
3408
 
3409
- #: inc/admin/views/course/section-item.php:40
3410
- #: inc/admin/views/quiz/question-actions.php:48
3411
- msgid "Delete permanently"
3412
  msgstr ""
3413
 
3414
- #: inc/admin/views/course/section.php:20
3415
  msgid "Enter the name section"
3416
  msgstr ""
3417
 
3418
- #: inc/admin/views/course/section.php:34
3419
  msgid "Describe about this section"
3420
  msgstr ""
3421
 
3422
- #: inc/admin/views/course/section.php:52
3423
  msgid "Select items"
3424
  msgstr ""
3425
 
3426
- #: inc/admin/views/course/section.php:56
3427
  msgid "Are you sure?"
3428
  msgstr ""
3429
 
@@ -3453,8 +3468,8 @@ msgstr ""
3453
 
3454
  #: inc/admin/views/meta-boxes/course/assigned.php:27
3455
  #: inc/admin/views/meta-boxes/quiz/assigned.php:49
3456
- #: inc/custom-post-types/lesson.php:353 inc/custom-post-types/question.php:362
3457
- #: inc/custom-post-types/quiz.php:374
3458
  msgid "Not assigned yet"
3459
  msgstr ""
3460
 
@@ -3519,10 +3534,7 @@ msgid "View all"
3519
  msgstr ""
3520
 
3521
  #: inc/admin/views/meta-boxes/order/actions.php:19
3522
- #: inc/admin/views/quiz/editor.php:28
3523
- #: inc/admin/views/tools/course/html-course.php:28
3524
- #: inc/admin/views/tools/course/html-user.php:28
3525
- msgid "Actions"
3526
  msgstr ""
3527
 
3528
  #: inc/admin/views/meta-boxes/order/actions.php:20
@@ -3537,6 +3549,19 @@ msgstr ""
3537
  msgid "Move to Trash"
3538
  msgstr ""
3539
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3540
  #: inc/admin/views/meta-boxes/order/details.php:26
3541
  #, php-format
3542
  msgid "Order %s"
@@ -3544,9 +3569,9 @@ msgstr ""
3544
 
3545
  #: inc/admin/views/meta-boxes/order/details.php:39
3546
  #: inc/admin/views/statistics/orders.php:46
3547
- #: inc/custom-post-types/order.php:712
3548
- #: templates/checkout/order-received.php:35
3549
- #: templates/profile/tabs/courses.php:33 templates/profile/tabs/quizzes.php:38
3550
  #: templates/profile/tabs/courses/purchased.php:39
3551
  #: templates/profile/tabs/orders/list.php:33
3552
  msgid "Date"
@@ -3556,71 +3581,62 @@ msgstr ""
3556
  msgid "Customers"
3557
  msgstr ""
3558
 
3559
- #: inc/admin/views/meta-boxes/order/details.php:79
3560
- #: inc/admin/views/meta-boxes/order/details.php:100
3561
- #: inc/admin/views/meta-boxes/order/details.php:207
3562
  msgid "Add multi users"
3563
  msgstr ""
3564
 
3565
- #: inc/admin/views/meta-boxes/order/details.php:82
3566
- #: inc/admin/views/meta-boxes/order/details.php:193
3567
- #: inc/admin/views/meta-boxes/order/details.php:202
3568
- msgid "Customer"
3569
- msgstr ""
3570
-
3571
- #: inc/admin/views/meta-boxes/order/details.php:93
3572
- #: inc/admin/views/meta-boxes/order/details.php:198
3573
  msgid "Change"
3574
  msgstr ""
3575
 
3576
- #: inc/admin/views/meta-boxes/order/details.php:98
3577
  msgid "- Or -"
3578
  msgstr ""
3579
 
3580
- #: inc/admin/views/meta-boxes/order/details.php:105
3581
  msgid ""
3582
  "In order to change the order user, please change the order status to "
3583
  "'Pending'."
3584
  msgstr ""
3585
 
3586
- #: inc/admin/views/meta-boxes/order/details.php:114
3587
- #: templates/order/recover-form.php:22
3588
- msgid "Order key"
3589
- msgstr ""
3590
-
3591
- #: inc/admin/views/meta-boxes/order/details.php:118
3592
  msgid "Order Items"
3593
  msgstr ""
3594
 
3595
- #: inc/admin/views/meta-boxes/order/details.php:123
 
3596
  #: inc/gateways/paypal/class-lp-gateway-paypal.php:434
 
3597
  msgid "Item"
3598
  msgstr ""
3599
 
3600
- #: inc/admin/views/meta-boxes/order/details.php:124
3601
  msgid "Cost"
3602
  msgstr ""
3603
 
3604
- #: inc/admin/views/meta-boxes/order/details.php:125
3605
  #: templates/emails/order-items-table.php:58
3606
  msgid "Quantity"
3607
  msgstr ""
3608
 
3609
- #: inc/admin/views/meta-boxes/order/details.php:126
3610
  msgid "Amount"
3611
  msgstr ""
3612
 
3613
- #: inc/admin/views/meta-boxes/order/details.php:136
3614
  msgid "No order items"
3615
  msgstr ""
3616
 
3617
- #: inc/admin/views/meta-boxes/order/details.php:142
3618
  msgid "Sub Total"
3619
  msgstr ""
3620
 
3621
- #: inc/admin/views/meta-boxes/order/details.php:156
3622
- #: inc/custom-post-types/order.php:713
3623
- #: templates/checkout/order-received.php:41
3624
  #: templates/checkout/review-order.php:33
3625
  #: templates/checkout/review-order.php:162
3626
  #: templates/emails/order-items-table.php:87
@@ -3630,37 +3646,33 @@ msgstr ""
3630
  msgid "Total"
3631
  msgstr ""
3632
 
3633
- #: inc/admin/views/meta-boxes/order/details.php:172
3634
  msgid "Add Item"
3635
  msgstr ""
3636
 
3637
- #: inc/admin/views/meta-boxes/order/details.php:175
3638
  msgid ""
3639
  "In order to change the order item, please change the order status to "
3640
  "'Pending'."
3641
  msgstr ""
3642
 
3643
- #: inc/admin/views/meta-boxes/order/details.php:178
3644
  msgid "Calculate Total"
3645
  msgstr ""
3646
 
3647
- #: inc/admin/views/meta-boxes/order/details.php:186
3648
  msgid "Customer Note"
3649
  msgstr ""
3650
 
3651
- #: inc/admin/views/meta-boxes/order/details.php:233
3652
  msgid "Type here to search the course"
3653
  msgstr ""
3654
 
3655
- #: inc/admin/views/meta-boxes/order/details.php:236
3656
  msgid "No results"
3657
  msgstr ""
3658
 
3659
- #: inc/admin/views/meta-boxes/order/order-item.php:17
3660
- msgid "delete"
3661
- msgstr ""
3662
-
3663
- #: inc/admin/views/question/actions.php:12
3664
  msgid "Question Answers"
3665
  msgstr ""
3666
 
@@ -3670,7 +3682,8 @@ msgid "Answer Text"
3670
  msgstr ""
3671
 
3672
  #: inc/admin/views/question/answer.php:19
3673
- msgid "Correct answer"
 
3674
  msgstr ""
3675
 
3676
  #: inc/admin/views/question/answer.php:35
@@ -3680,76 +3693,82 @@ msgstr ""
3680
 
3681
  #: inc/admin/views/quiz/editor.php:16
3682
  #: inc/admin/views/quiz/modal-choose-items.php:55
3683
- #: inc/custom-post-types/question.php:170 inc/custom-post-types/quiz.php:337
3684
- #: templates/content-quiz/intro.php:36
3685
  msgid "Questions"
3686
  msgstr ""
3687
 
3688
- #: inc/admin/views/quiz/editor.php:27 inc/admin/views/settings/payments.php:24
3689
- #: inc/custom-post-types/question.php:321
3690
  msgid "Type"
3691
  msgstr ""
3692
 
3693
- #: inc/admin/views/quiz/editor.php:42
3694
- msgid " Create a new question"
 
 
 
 
 
 
3695
  msgstr ""
3696
 
3697
- #: inc/admin/views/quiz/editor.php:49
3698
- msgid "Add as New"
3699
  msgstr ""
3700
 
3701
- #: inc/admin/views/quiz/editor.php:59
3702
- #: inc/libraries/meta-box/inc/fields/file-input.php:38
3703
  #: inc/libraries/meta-box/inc/fields/select.php:87
3704
  msgid "Select"
3705
  msgstr ""
3706
 
3707
- #: inc/admin/views/quiz/editor.php:85
3708
  msgid "Something went wrong! Please reload to continue editing quiz questions."
3709
  msgstr ""
3710
 
3711
- #: inc/admin/views/quiz/question-actions.php:44
3712
- msgid "Remove from quiz"
3713
  msgstr ""
3714
 
3715
- #: inc/admin/views/quiz/question-answer.php:20
3716
- msgid "Is Correct?"
3717
  msgstr ""
3718
 
3719
- #: inc/admin/views/quiz/question-meta.php:18
3720
  #: inc/question/class-lp-question.php:412
3721
  msgid "Question Content"
3722
  msgstr ""
3723
 
3724
- #: inc/admin/views/quiz/question-meta.php:30
3725
- #: inc/custom-post-types/question.php:281
3726
  msgid "Mark for this question"
3727
  msgstr ""
3728
 
3729
- #: inc/admin/views/quiz/question-meta.php:36
3730
- #: inc/custom-post-types/question.php:285
3731
  msgid "Mark for choosing the right answer."
3732
  msgstr ""
3733
 
3734
- #: inc/admin/views/quiz/question-meta.php:42
3735
- #: inc/custom-post-types/question.php:290
3736
  msgid "Question Explanation"
3737
  msgstr ""
3738
 
3739
- #: inc/admin/views/quiz/question-meta.php:50
3740
- #: inc/custom-post-types/question.php:293
3741
  msgid ""
3742
  "Explain why an option is true and other is false. The text will be shown "
3743
  "when user click on 'Check answer' button."
3744
  msgstr ""
3745
 
3746
- #: inc/admin/views/quiz/question-meta.php:56
3747
- #: inc/custom-post-types/question.php:297
3748
  msgid "Question Hint"
3749
  msgstr ""
3750
 
3751
- #: inc/admin/views/quiz/question-meta.php:63
3752
- #: inc/custom-post-types/question.php:300
3753
  msgid ""
3754
  "Instruction for user to select the right answer. The text will be shown when "
3755
  "users click the 'Hint' button."
@@ -3765,10 +3784,7 @@ msgstr ""
3765
  #: inc/emails/class-lp-email-updated-course.php:164
3766
  #: inc/emails/class-lp-email-user-order-changed-status.php:136
3767
  #: inc/emails/class-lp-email-user-order-completed.php:137
3768
- #: inc/emails/class-lp-email.php:982
3769
- #: inc/emails/_bk/class-lp-email-finished-course-admin.php:131
3770
- #: inc/emails/_bk/class-lp-email-finished-course-instructor.php:133
3771
- #: inc/emails/_bk/class-lp-email-finished-course-user.php:133
3772
  #: inc/gateways/paypal/class-lp-gateway-paypal.php:498
3773
  msgid "Enable"
3774
  msgstr ""
@@ -3841,10 +3857,7 @@ msgstr ""
3841
  #: inc/emails/class-lp-email-updated-course.php:170
3842
  #: inc/emails/class-lp-email-user-order-changed-status.php:142
3843
  #: inc/emails/class-lp-email-user-order-completed.php:143
3844
- #: inc/emails/class-lp-email.php:1005
3845
- #: inc/emails/_bk/class-lp-email-finished-course-admin.php:137
3846
- #: inc/emails/_bk/class-lp-email-finished-course-instructor.php:139
3847
- #: inc/emails/_bk/class-lp-email-finished-course-user.php:139
3848
  msgid "Subject"
3849
  msgstr ""
3850
 
@@ -3864,10 +3877,7 @@ msgstr ""
3864
  #: inc/emails/class-lp-email-updated-course.php:204
3865
  #: inc/emails/class-lp-email-user-order-changed-status.php:176
3866
  #: inc/emails/class-lp-email-user-order-completed.php:177
3867
- #: inc/emails/class-lp-email.php:1039
3868
- #: inc/emails/_bk/class-lp-email-finished-course-admin.php:171
3869
- #: inc/emails/_bk/class-lp-email-finished-course-instructor.php:173
3870
- #: inc/emails/_bk/class-lp-email-finished-course-user.php:173
3871
  msgid "Email content"
3872
  msgstr ""
3873
 
@@ -3954,7 +3964,7 @@ msgstr ""
3954
 
3955
  #: inc/admin/views/setup/content.php:75
3956
  #: inc/admin/views/updates/update-screen.php:46
3957
- #: inc/custom-post-types/course.php:213 inc/custom-post-types/quiz.php:176
3958
  #: templates/checkout/form.php:89 templates/checkout/payment.php:132
3959
  msgid "Back"
3960
  msgstr ""
@@ -4265,49 +4275,47 @@ msgid "There is no template file has overwritten"
4265
  msgstr ""
4266
 
4267
  #: inc/admin/views/tools/course/html-course.php:12
4268
- msgid "Reset course user data"
4269
  msgstr ""
4270
 
4271
  #: inc/admin/views/tools/course/html-course.php:14
4272
- msgid "Search results only show course have user data."
 
4273
  msgstr ""
4274
 
4275
- #: inc/admin/views/tools/course/html-course.php:18
4276
- #: inc/admin/views/tools/course/html-user.php:18 templates/search-form.php:29
4277
- msgid "Search"
4278
  msgstr ""
4279
 
4280
- #: inc/admin/views/tools/course/html-course.php:39
4281
- #: inc/admin/views/tools/course/html-user.php:47
4282
- msgid "Done"
4283
  msgstr ""
4284
 
4285
- #: inc/admin/views/tools/course/html-course.php:40
4286
- #: inc/admin/views/tools/course/html-user.php:48
4287
- msgid "Resetting..."
4288
  msgstr ""
4289
 
4290
- #: inc/admin/views/tools/course/html-course.php:47
4291
  msgid "Please enter at least 3 characters to searching courses."
4292
  msgstr ""
4293
 
4294
- #: inc/admin/views/tools/course/html-course.php:49
4295
  msgid "Searching course..."
4296
  msgstr ""
4297
 
4298
- #: inc/admin/views/tools/course/html-course.php:57
4299
- #: inc/admin/views/tools/course/html-user-item.php:35
4300
- #: inc/admin/views/tools/course/html-user.php:65
4301
- msgid "Remove all users from this course?"
4302
  msgstr ""
4303
 
4304
  #: inc/admin/views/tools/course/html-user-item.php:12
4305
- msgid "Reset item data for an user"
4306
  msgstr ""
4307
 
4308
  #: inc/admin/views/tools/course/html-user-item.php:14
4309
- #: inc/admin/views/tools/course/html-user.php:14
4310
- msgid "Search results only show users have course data."
4311
  msgstr ""
4312
 
4313
  #: inc/admin/views/tools/course/html-user-item.php:18
@@ -4318,23 +4326,36 @@ msgstr ""
4318
  msgid "Item ID (ID of quiz or lesson)"
4319
  msgstr ""
4320
 
 
 
 
 
4321
  #: inc/admin/views/tools/course/html-user.php:12
4322
- msgid "Reset course data by user"
 
 
 
 
 
 
 
 
 
4323
  msgstr ""
4324
 
4325
- #: inc/admin/views/tools/course/html-user.php:46
4326
- msgid "Reset all"
4327
  msgstr ""
4328
 
4329
- #: inc/admin/views/tools/course/html-user.php:55
4330
  msgid "Please enter at least 3 characters to searching users."
4331
  msgstr ""
4332
 
4333
- #: inc/admin/views/tools/course/html-user.php:56
4334
  msgid "No user found."
4335
  msgstr ""
4336
 
4337
- #: inc/admin/views/tools/course/html-user.php:57
4338
  msgid "Searching user..."
4339
  msgstr ""
4340
 
@@ -4413,7 +4434,7 @@ msgstr ""
4413
 
4414
  #: inc/admin/views/tools/database/html-remove-database.php:23
4415
  #: inc/admin/views/tools/database/html-remove-outdated-data.php:23
4416
- #: inc/libraries/meta-box/inc/fields/file-input.php:40
4417
  #: templates/profile/tabs/settings/avatar.php:60
4418
  msgid "Remove"
4419
  msgstr ""
@@ -4450,6 +4471,16 @@ msgid ""
4450
  "latest version."
4451
  msgstr ""
4452
 
 
 
 
 
 
 
 
 
 
 
4453
  #: inc/admin/views/updates/html-upgrade-message-3.0.0.php:14
4454
  #, php-format
4455
  msgid "Welcome to LearnPress %s"
@@ -4653,11 +4684,11 @@ msgstr ""
4653
  msgid "No &quot;Course %s&quot; found"
4654
  msgstr ""
4655
 
4656
- #: inc/background-process/class-lp-background-query-items.php:83
4657
  msgid "WP query plugins error!"
4658
  msgstr ""
4659
 
4660
- #: inc/background-process/class-lp-background-query-items.php:86
4661
  msgid "WP query plugins empty!"
4662
  msgstr ""
4663
 
@@ -4679,11 +4710,11 @@ msgid ""
4679
  "%s has been removed from your cart because it can no longer be purchased."
4680
  msgstr ""
4681
 
4682
- #: inc/course/abstract-course.php:527
4683
  msgid "You enrolled"
4684
  msgstr ""
4685
 
4686
- #: inc/course/abstract-course.php:531
4687
  #, php-format
4688
  msgctxt "students-html"
4689
  msgid "You and one student enrolled"
@@ -4692,7 +4723,7 @@ msgid_plural ""
4692
  msgstr[0] ""
4693
  msgstr[1] ""
4694
 
4695
- #: inc/course/abstract-course.php:541
4696
  #, php-format
4697
  msgctxt "students-html"
4698
  msgid "One student enrolled"
@@ -4701,37 +4732,37 @@ msgid_plural ""
4701
  msgstr[0] ""
4702
  msgstr[1] ""
4703
 
4704
- #: inc/course/abstract-course.php:544
4705
  msgid "No student enrolled"
4706
  msgstr ""
4707
 
4708
- #: inc/course/abstract-course.php:799 inc/course/abstract-course.php:817
4709
- #: inc/lesson/class-lp-lesson.php:103 inc/quiz/class-lp-quiz.php:516
4710
  #, php-format
4711
  msgid "The function %s doesn't exist"
4712
  msgstr ""
4713
 
4714
- #: inc/course/abstract-course.php:1178
4715
  #, php-format
4716
  msgid "%d of %d items completed"
4717
  msgstr ""
4718
 
4719
- #: inc/course/abstract-course.php:1181 inc/course/abstract-course.php:1183
4720
  #, php-format
4721
  msgid "%d%% completed"
4722
  msgstr ""
4723
 
4724
- #: inc/course/abstract-course.php:1651
4725
  #, php-format
4726
  msgid "This course will end within next %s"
4727
  msgstr ""
4728
 
4729
- #: inc/course/abstract-course.php:1758
4730
  msgctxt "Text of Buy this course with external link"
4731
  msgid "Buy this course"
4732
  msgstr ""
4733
 
4734
- #: inc/course/abstract-course.php:1808
4735
  msgid "Tags: "
4736
  msgstr ""
4737
 
@@ -4745,11 +4776,11 @@ msgstr ""
4745
  msgid "The course %d does not exists"
4746
  msgstr ""
4747
 
4748
- #: inc/course/lp-course-functions.php:830
4749
  msgid "Permalink only available if the item is already assigned to a course."
4750
  msgstr ""
4751
 
4752
- #: inc/course/lp-course-functions.php:1039
4753
  #, php-format
4754
  msgid "Welcome back, %s"
4755
  msgstr ""
@@ -4804,7 +4835,7 @@ msgid "Invalid order with ID \"%d\"."
4804
  msgstr ""
4805
 
4806
  #: inc/curds/class-lp-order-curd.php:485
4807
- #: templates/checkout/order-received.php:61
4808
  msgid "Invalid order."
4809
  msgstr ""
4810
 
@@ -4858,41 +4889,41 @@ msgstr ""
4858
  msgid "<p>Sorry! Failed to duplicate quiz!</p>"
4859
  msgstr ""
4860
 
4861
- #: inc/curds/class-lp-user-curd.php:1079 inc/curds/class-lp-user-curd.php:1237
4862
  msgid "course"
4863
  msgstr ""
4864
 
4865
- #: inc/curds/class-lp-user-curd.php:1080 inc/curds/class-lp-user-curd.php:1238
4866
  msgid "courses"
4867
  msgstr ""
4868
 
4869
- #: inc/curds/class-lp-user-curd.php:1379
4870
  msgid "quiz"
4871
  msgstr ""
4872
 
4873
- #: inc/curds/class-lp-user-curd.php:1380
4874
  msgid "quizzes"
4875
  msgstr ""
4876
 
4877
- #: inc/curds/class-lp-user-curd.php:1437
4878
  msgid "Please provide a valid email address."
4879
  msgstr ""
4880
 
4881
- #: inc/curds/class-lp-user-curd.php:1441
4882
  msgid ""
4883
  "An account is already registered with your email address. Please log in."
4884
  msgstr ""
4885
 
4886
- #: inc/curds/class-lp-user-curd.php:1447
4887
  msgid "Please enter a valid account username."
4888
  msgstr ""
4889
 
4890
- #: inc/curds/class-lp-user-curd.php:1451
4891
  msgid ""
4892
  "An account is already registered with that username. Please choose another."
4893
  msgstr ""
4894
 
4895
- #: inc/curds/class-lp-user-curd.php:1463
4896
  msgid "Failed to create user"
4897
  msgstr ""
4898
 
@@ -4904,499 +4935,535 @@ msgstr ""
4904
  msgid "Invalid quiz."
4905
  msgstr ""
4906
 
4907
- #: inc/custom-post-types/abstract.php:473
4908
- #: inc/custom-post-types/abstract.php:476
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4909
  msgid "updated."
4910
  msgstr ""
4911
 
4912
- #: inc/custom-post-types/abstract.php:474
4913
  msgid "Custom field updated."
4914
  msgstr ""
4915
 
4916
- #: inc/custom-post-types/abstract.php:475
4917
  msgid "Custom field deleted."
4918
  msgstr ""
4919
 
4920
- #: inc/custom-post-types/abstract.php:478
4921
  #, php-format
4922
  msgid "Lesson restored to revision from %s"
4923
  msgstr ""
4924
 
4925
- #: inc/custom-post-types/abstract.php:479
4926
  msgid "published."
4927
  msgstr ""
4928
 
4929
- #: inc/custom-post-types/abstract.php:480
4930
  msgid "saved."
4931
  msgstr ""
4932
 
4933
- #: inc/custom-post-types/abstract.php:481
4934
  msgid "submitted."
4935
  msgstr ""
4936
 
4937
- #: inc/custom-post-types/abstract.php:483
4938
  #, php-format
4939
  msgid "scheduled for: <strong>%1$s</strong>."
4940
  msgstr ""
4941
 
4942
- #: inc/custom-post-types/abstract.php:485
4943
  msgid "M j, Y @ G:i"
4944
  msgstr ""
4945
 
4946
- #: inc/custom-post-types/abstract.php:487
4947
  msgid "draft updated."
4948
  msgstr ""
4949
 
4950
- #: inc/custom-post-types/course.php:72
 
 
 
 
 
 
 
 
 
 
 
 
4951
  msgctxt "Post Type General Name"
4952
  msgid "Courses"
4953
  msgstr ""
4954
 
4955
- #: inc/custom-post-types/course.php:73
4956
  msgctxt "Post Type Singular Name"
4957
  msgid "Course"
4958
  msgstr ""
4959
 
4960
- #: inc/custom-post-types/course.php:75
4961
  msgid "Parent Item:"
4962
  msgstr ""
4963
 
4964
- #: inc/custom-post-types/course.php:77
4965
  msgid "View Course"
4966
  msgstr ""
4967
 
4968
- #: inc/custom-post-types/course.php:78
4969
  msgid "Add New Course"
4970
  msgstr ""
4971
 
4972
- #: inc/custom-post-types/course.php:79 inc/custom-post-types/lesson.php:185
4973
- #: inc/custom-post-types/order.php:849 inc/custom-post-types/question.php:173
4974
  msgid "Add New"
4975
  msgstr ""
4976
 
4977
- #: inc/custom-post-types/course.php:80
4978
  msgid "Edit Course"
4979
  msgstr ""
4980
 
4981
- #: inc/custom-post-types/course.php:81
4982
  msgid "Update Course"
4983
  msgstr ""
4984
 
4985
- #: inc/custom-post-types/course.php:82
4986
  msgid "Search Courses"
4987
  msgstr ""
4988
 
4989
- #: inc/custom-post-types/course.php:83
4990
  #, php-format
4991
  msgid ""
4992
  "You haven't had any courses yet. Click <a href=\"%s\">Add new</a> to start"
4993
  msgstr ""
4994
 
4995
- #: inc/custom-post-types/course.php:84
4996
  msgid "No course found in Trash"
4997
  msgstr ""
4998
 
4999
- #: inc/custom-post-types/course.php:124 inc/custom-post-types/course.php:126
5000
  msgid "Course Categories"
5001
  msgstr ""
5002
 
5003
- #: inc/custom-post-types/course.php:127 inc/custom-post-types/course.php:128
5004
  msgid "Category"
5005
  msgstr ""
5006
 
5007
- #: inc/custom-post-types/course.php:129
5008
  msgid "Add New Course Category"
5009
  msgstr ""
5010
 
5011
- #: inc/custom-post-types/course.php:130
5012
  msgid "All Categories"
5013
  msgstr ""
5014
 
5015
- #: inc/custom-post-types/course.php:141
5016
  msgctxt "slug"
5017
  msgid "course-category"
5018
  msgstr ""
5019
 
5020
- #: inc/custom-post-types/course.php:152
5021
  msgid "Course Tags"
5022
  msgstr ""
5023
 
5024
- #: inc/custom-post-types/course.php:153 inc/custom-post-types/question.php:146
5025
- #: inc/custom-post-types/question.php:147
5026
  #: inc/updates/_update-from-0.9.php:1194 inc/updates/_update-from-0.9.php:1195
5027
  #: inc/updates/_update-from-0.9.php:1196 inc/updates/_update-from-0.9.php:1217
5028
  #: inc/updates/_update-from-0.9.php:1218
5029
  msgid "Tag"
5030
  msgstr ""
5031
 
5032
- #: inc/custom-post-types/course.php:154
5033
  msgid "Search Course Tags"
5034
  msgstr ""
5035
 
5036
- #: inc/custom-post-types/course.php:155
5037
  msgid "Popular Course Tags"
5038
  msgstr ""
5039
 
5040
- #: inc/custom-post-types/course.php:156
5041
  msgid "All Course Tags"
5042
  msgstr ""
5043
 
5044
- #: inc/custom-post-types/course.php:159
5045
  msgid "Edit Course Tag"
5046
  msgstr ""
5047
 
5048
- #: inc/custom-post-types/course.php:160
5049
  msgid "Update Course Tag"
5050
  msgstr ""
5051
 
5052
- #: inc/custom-post-types/course.php:161
5053
  msgid "Add New Course Tag"
5054
  msgstr ""
5055
 
5056
- #: inc/custom-post-types/course.php:162
5057
  msgid "New Course Tag Name"
5058
  msgstr ""
5059
 
5060
- #: inc/custom-post-types/course.php:163
5061
  msgid "Separate tags with commas"
5062
  msgstr ""
5063
 
5064
- #: inc/custom-post-types/course.php:164
5065
  msgid "Add or remove tags"
5066
  msgstr ""
5067
 
5068
- #: inc/custom-post-types/course.php:165
5069
  msgid "Choose from the most used tags"
5070
  msgstr ""
5071
 
5072
- #: inc/custom-post-types/course.php:175
5073
  msgctxt "slug"
5074
  msgid "course-tag"
5075
  msgstr ""
5076
 
5077
- #: inc/custom-post-types/course.php:212
5078
- msgid "Create a new"
5079
- msgstr ""
5080
-
5081
- #: inc/custom-post-types/course.php:345
5082
  msgid "Sorry! You can not update a course while it is being viewed!"
5083
  msgstr ""
5084
 
5085
- #: inc/custom-post-types/course.php:516
5086
  msgid "Course Settings"
5087
  msgstr ""
5088
 
5089
- #: inc/custom-post-types/course.php:538 inc/custom-post-types/lesson.php:312
5090
- #: inc/custom-post-types/quiz.php:253 inc/custom-post-types/quiz.php:338
5091
  #: templates/content-quiz/intro.php:28
5092
  msgid "Duration"
5093
  msgstr ""
5094
 
5095
- #: inc/custom-post-types/course.php:541
5096
  msgid "The duration of the course."
5097
  msgstr ""
5098
 
5099
- #: inc/custom-post-types/course.php:545
5100
  msgid "Maximum Students"
5101
  msgstr ""
5102
 
5103
- #: inc/custom-post-types/course.php:548
5104
  msgid "Maximum number of students who can enroll in this course."
5105
  msgstr ""
5106
 
5107
- #: inc/custom-post-types/course.php:552
5108
  msgid "Students Enrolled"
5109
  msgstr ""
5110
 
5111
- #: inc/custom-post-types/course.php:555
5112
  msgid "How many students have taken this course."
5113
  msgstr ""
5114
 
5115
- #: inc/custom-post-types/course.php:566
5116
  msgid "Re-take Course"
5117
  msgstr ""
5118
 
5119
- #: inc/custom-post-types/course.php:570
5120
  msgid ""
5121
  "How many times the user can re-take this course. Set to 0 to disable re-"
5122
  "taking"
5123
  msgstr ""
5124
 
5125
- #: inc/custom-post-types/course.php:574
5126
  msgid "Featured"
5127
  msgstr ""
5128
 
5129
- #: inc/custom-post-types/course.php:577
5130
  msgid "Set course as featured."
5131
  msgstr ""
5132
 
5133
- #: inc/custom-post-types/course.php:581
5134
- msgid "Block Lessons Content"
5135
  msgstr ""
5136
 
5137
- #: inc/custom-post-types/course.php:584
5138
  msgid "Block lessons content when completed course."
5139
  msgstr ""
5140
 
5141
- #: inc/custom-post-types/course.php:588
5142
- msgid "External Link to buy Course"
5143
  msgstr ""
5144
 
5145
- #: inc/custom-post-types/course.php:591
5146
  msgid "Redirect to this url when you press button buy this course."
5147
  msgstr ""
5148
 
5149
- #: inc/custom-post-types/course.php:619
5150
  msgid "The method to assess the result of a student for a course."
5151
  msgstr ""
5152
 
5153
- #: inc/custom-post-types/course.php:622
5154
  msgid ""
5155
  "<br /><strong>Note! </strong>No final quiz in course, please add a final quiz"
5156
  msgstr ""
5157
 
5158
- #: inc/custom-post-types/course.php:639
5159
  msgid ""
5160
  "This is conditional \"passing grade\" of Final quiz will apply for result of "
5161
  "this course. When you change it here, the \"passing grade\" also change with "
5162
  "new value for the Final quiz."
5163
  msgstr ""
5164
 
5165
- #: inc/custom-post-types/course.php:645
5166
  msgid ""
5167
  "<p>Evaluate by number of lessons completed per number of total lessons.</p>"
5168
  msgstr ""
5169
 
5170
- #: inc/custom-post-types/course.php:646
5171
  msgid ""
5172
  "E.g: Course has 10 lessons and user completed 5 lessons then the result = "
5173
  "5/10 = 50.%"
5174
  msgstr ""
5175
 
5176
- #: inc/custom-post-types/course.php:647
5177
  msgid ""
5178
  "Evaluate by results of final quiz in course. You have to add a quiz into end "
5179
  "of course."
5180
  msgstr ""
5181
 
5182
- #: inc/custom-post-types/course.php:648
5183
  msgid ""
5184
  "Evaluate by achieved points of completed quizzes per total point of all "
5185
  "quizzes."
5186
  msgstr ""
5187
 
5188
- #: inc/custom-post-types/course.php:649
5189
  msgid ""
5190
  "Evaluate by achieved points of quizzes passed per total point of all quizzes."
5191
  msgstr ""
5192
 
5193
- #: inc/custom-post-types/course.php:650
5194
  msgid ""
5195
  "<p>Evaluate by number of quizzes completed per number of total quizzes.</p>"
5196
  msgstr ""
5197
 
5198
- #: inc/custom-post-types/course.php:651
5199
  msgid ""
5200
  "<p>E.g: Course has 10 quizzes and user completed 5 quizzes then the result = "
5201
  "5/10 = 50%.</p>"
5202
  msgstr ""
5203
 
5204
- #: inc/custom-post-types/course.php:658
5205
  msgid "Assessment"
5206
  msgstr ""
5207
 
5208
- #: inc/custom-post-types/course.php:664
5209
  msgid "Course result"
5210
  msgstr ""
5211
 
5212
- #: inc/custom-post-types/course.php:669
5213
  msgid "Evaluate via lessons"
5214
  msgstr ""
5215
 
5216
- #: inc/custom-post-types/course.php:671
5217
  msgid "Evaluate via results of the final quiz"
5218
  msgstr ""
5219
 
5220
- #: inc/custom-post-types/course.php:674
5221
  msgid "Evaluate via results of quizzes"
5222
  msgstr ""
5223
 
5224
- #: inc/custom-post-types/course.php:676
5225
  msgid "Evaluate via results of quizzes passed"
5226
  msgstr ""
5227
 
5228
- #: inc/custom-post-types/course.php:678
5229
  msgid "Evaluate via quizzes"
5230
  msgstr ""
5231
 
5232
- #: inc/custom-post-types/course.php:685
5233
  msgid "Passing condition value"
5234
  msgstr ""
5235
 
5236
- #: inc/custom-post-types/course.php:690
5237
  msgid ""
5238
  "The percentage of quiz result or completed lessons to finish the course."
5239
  msgstr ""
5240
 
5241
- #: inc/custom-post-types/course.php:753
5242
  #, php-format
5243
  msgid ""
5244
  "This course requires enrollment and the suggested price is <strong>%s</"
5245
  "strong>"
5246
  msgstr ""
5247
 
5248
- #: inc/custom-post-types/course.php:761
5249
  msgid "This course is free."
5250
  msgstr ""
5251
 
5252
- #: inc/custom-post-types/course.php:768
5253
  #, php-format
5254
  msgid "Course price in <strong>%s</strong> currency."
5255
  msgstr ""
5256
 
5257
- #: inc/custom-post-types/course.php:782 inc/custom-post-types/course.php:1243
5258
- #: inc/custom-post-types/course.php:1250
5259
  #: templates/emails/order-items-table.php:59
5260
  msgid "Price"
5261
  msgstr ""
5262
 
5263
- #: inc/custom-post-types/course.php:792
5264
  msgid "Sale Price"
5265
  msgstr ""
5266
 
5267
- #: inc/custom-post-types/course.php:799
5268
  #, php-format
5269
  msgid "Course sale price in <strong>%s</strong> currency."
5270
  msgstr ""
5271
 
5272
- #: inc/custom-post-types/course.php:800
5273
  msgid "Leave blank to remove sale price."
5274
  msgstr ""
5275
 
5276
- #: inc/custom-post-types/course.php:802
5277
  msgid "Schedule"
5278
  msgstr ""
5279
 
5280
- #: inc/custom-post-types/course.php:807
5281
  msgid "Sale start date"
5282
  msgstr ""
5283
 
5284
- #: inc/custom-post-types/course.php:815
5285
  msgid "Sale end date"
5286
  msgstr ""
5287
 
5288
- #: inc/custom-post-types/course.php:827
5289
  msgid "Price set by Admin"
5290
  msgstr ""
5291
 
5292
- #: inc/custom-post-types/course.php:831
5293
  msgid "Not set"
5294
  msgstr ""
5295
 
5296
- #: inc/custom-post-types/course.php:834
5297
  msgid "Course Suggestion Price"
5298
  msgstr ""
5299
 
5300
- #: inc/custom-post-types/course.php:839
5301
  msgid "The course price you want to suggest for admin to set."
5302
  msgstr ""
5303
 
5304
- #: inc/custom-post-types/course.php:850
5305
- msgid "No require enrollment"
5306
  msgstr ""
5307
 
5308
- #: inc/custom-post-types/course.php:853
5309
  msgid "Require users logged in to study or public to all."
5310
  msgstr ""
5311
 
5312
- #: inc/custom-post-types/course.php:893 inc/custom-post-types/course.php:899
5313
- #: inc/custom-post-types/course.php:1240 inc/custom-post-types/course.php:1247
5314
- #: inc/custom-post-types/lesson.php:307 inc/custom-post-types/question.php:319
5315
- #: inc/custom-post-types/quiz.php:335
5316
  msgid "Author"
5317
  msgstr ""
5318
 
5319
- #: inc/custom-post-types/course.php:921
5320
  msgid "Review Logs"
5321
  msgstr ""
5322
 
5323
- #: inc/custom-post-types/course.php:970
5324
  msgid "Course Video"
5325
  msgstr ""
5326
 
5327
- #: inc/custom-post-types/course.php:975
5328
  msgid "Video ID"
5329
  msgstr ""
5330
 
5331
- #: inc/custom-post-types/course.php:978
5332
  msgid "The ID of Youtube or Vimeo video"
5333
  msgstr ""
5334
 
5335
- #: inc/custom-post-types/course.php:982
5336
  msgid "Video Type"
5337
  msgstr ""
5338
 
5339
- #: inc/custom-post-types/course.php:985
5340
  msgid "Chose video type"
5341
  msgstr ""
5342
 
5343
- #: inc/custom-post-types/course.php:988
5344
  msgid "Youtube"
5345
  msgstr ""
5346
 
5347
- #: inc/custom-post-types/course.php:989
5348
  msgid "Vimeo"
5349
  msgstr ""
5350
 
5351
- #: inc/custom-post-types/course.php:993
5352
  msgid "Embed width"
5353
  msgstr ""
5354
 
5355
- #: inc/custom-post-types/course.php:996
5356
  msgid "Set width of embed"
5357
  msgstr ""
5358
 
5359
- #: inc/custom-post-types/course.php:1000
5360
  msgid "Embed height"
5361
  msgstr ""
5362
 
5363
- #: inc/custom-post-types/course.php:1003
5364
  msgid "Set height of embed"
5365
  msgstr ""
5366
 
5367
- #: inc/custom-post-types/course.php:1125
5368
  msgid "Course has been approved by Reviewer"
5369
  msgstr ""
5370
 
5371
- #: inc/custom-post-types/course.php:1130
5372
  msgid "Course has been rejected by Reviewer"
5373
  msgstr ""
5374
 
5375
- #: inc/custom-post-types/course.php:1135
5376
  #, php-format
5377
  msgid "Course has been submitted by %s"
5378
  msgstr ""
5379
 
5380
- #: inc/custom-post-types/course.php:1140
5381
  msgid "Course has been updated by Reviewer"
5382
  msgstr ""
5383
 
5384
- #: inc/custom-post-types/course.php:1241 inc/custom-post-types/course.php:1248
5385
  msgid "Content"
5386
  msgstr ""
5387
 
5388
- #: inc/custom-post-types/course.php:1302
5389
  #, php-format
5390
  msgid "%d section"
5391
  msgid_plural "%d sections"
5392
  msgstr[0] ""
5393
  msgstr[1] ""
5394
 
5395
- #: inc/custom-post-types/course.php:1302
5396
  msgid "0 section"
5397
  msgstr ""
5398
 
5399
- #: inc/custom-post-types/course.php:1304
5400
  #: templates/widgets/featured-courses/default.php:86
5401
  #: templates/widgets/popular-courses/default.php:81
5402
  #: templates/widgets/recent-courses/default.php:86
@@ -5406,115 +5473,111 @@ msgid_plural "%d lessons"
5406
  msgstr[0] ""
5407
  msgstr[1] ""
5408
 
5409
- #: inc/custom-post-types/course.php:1304
5410
  msgid "0 lesson"
5411
  msgstr ""
5412
 
5413
- #: inc/custom-post-types/course.php:1306
5414
  #, php-format
5415
  msgid "%d quiz"
5416
  msgid_plural "%d quizzes"
5417
  msgstr[0] ""
5418
  msgstr[1] ""
5419
 
5420
- #: inc/custom-post-types/course.php:1306
5421
  msgid "0 quiz"
5422
  msgstr ""
5423
 
5424
- #: inc/custom-post-types/course.php:1313
5425
  msgid "No content"
5426
  msgstr ""
5427
 
5428
- #: inc/custom-post-types/course.php:1333
5429
- msgid "No required enroll"
5430
- msgstr ""
5431
-
5432
- #: inc/custom-post-types/lesson.php:95 inc/custom-post-types/question.php:64
5433
  #: inc/custom-post-types/quiz.php:64
5434
  #, php-format
5435
  msgid "Unassigned %s"
5436
  msgstr ""
5437
 
5438
- #: inc/custom-post-types/lesson.php:111
5439
  #, php-format
5440
  msgid "Preview %s"
5441
  msgstr ""
5442
 
5443
- #: inc/custom-post-types/lesson.php:128
5444
  #, php-format
5445
  msgid "No Preview %s"
5446
  msgstr ""
5447
 
5448
- #: inc/custom-post-types/lesson.php:179 inc/custom-post-types/lesson.php:180
5449
- #: inc/custom-post-types/lesson.php:183
5450
  #: templates/widgets/course-info/default.php:29
5451
  msgid "Lessons"
5452
  msgstr ""
5453
 
5454
- #: inc/custom-post-types/lesson.php:182
5455
  msgid "Add New Lesson"
5456
  msgstr ""
5457
 
5458
- #: inc/custom-post-types/lesson.php:184
5459
  msgid "View Lesson"
5460
  msgstr ""
5461
 
5462
- #: inc/custom-post-types/lesson.php:186
5463
  msgid "Edit Lesson"
5464
  msgstr ""
5465
 
5466
- #: inc/custom-post-types/lesson.php:187
5467
  msgid "Update Lesson"
5468
  msgstr ""
5469
 
5470
- #: inc/custom-post-types/lesson.php:188
5471
  msgid "Search Lessons"
5472
  msgstr ""
5473
 
5474
- #: inc/custom-post-types/lesson.php:189
5475
  msgid "No lesson found"
5476
  msgstr ""
5477
 
5478
- #: inc/custom-post-types/lesson.php:190
5479
  msgid "No lesson found in Trash"
5480
  msgstr ""
5481
 
5482
- #: inc/custom-post-types/lesson.php:224
5483
  msgid "Lesson Settings"
5484
  msgstr ""
5485
 
5486
- #: inc/custom-post-types/lesson.php:228
5487
  msgid "Lesson Duration"
5488
  msgstr ""
5489
 
5490
- #: inc/custom-post-types/lesson.php:232
5491
  msgid "Duration of the lesson. Set 0 to disable."
5492
  msgstr ""
5493
 
5494
- #: inc/custom-post-types/lesson.php:236
5495
  msgid "Preview Lesson"
5496
  msgstr ""
5497
 
5498
- #: inc/custom-post-types/lesson.php:239
5499
  msgid ""
5500
  "If this is a preview lesson, then student can view this lesson content "
5501
  "without taking the course."
5502
  msgstr ""
5503
 
5504
- #: inc/custom-post-types/lesson.php:311
5505
  msgid "Format"
5506
  msgstr ""
5507
 
5508
- #: inc/custom-post-types/lesson.php:366
5509
  msgid "Standard"
5510
  msgstr ""
5511
 
5512
- #: inc/custom-post-types/lesson.php:448
5513
  msgid "Please enter the title of the lesson"
5514
  msgstr ""
5515
 
5516
- #: inc/custom-post-types/lesson.php:490 inc/custom-post-types/question.php:513
5517
- #: inc/custom-post-types/quiz.php:610
5518
  msgid "Assigned"
5519
  msgstr ""
5520
 
@@ -5522,127 +5585,134 @@ msgstr ""
5522
  msgid "Order number, user name, user email, course name etc..."
5523
  msgstr ""
5524
 
5525
- #: inc/custom-post-types/order.php:575
5526
  msgid "Processing..."
5527
  msgstr ""
5528
 
5529
- #: inc/custom-post-types/order.php:592 inc/custom-post-types/order.php:595
5530
  msgid "Apply"
5531
  msgstr ""
5532
 
5533
- #: inc/custom-post-types/order.php:633 inc/custom-post-types/order.php:848
5534
  msgid "View Order"
5535
  msgstr ""
5536
 
5537
- #: inc/custom-post-types/order.php:641
5538
  msgid "View child orders"
5539
  msgstr ""
5540
 
5541
- #: inc/custom-post-types/order.php:709 inc/custom-post-types/order.php:844
5542
  #: templates/profile/tabs/orders/list.php:32
5543
  msgid "Order"
5544
  msgstr ""
5545
 
5546
- #: inc/custom-post-types/order.php:710
5547
  msgid "Student"
5548
  msgstr ""
5549
 
5550
- #: inc/custom-post-types/order.php:762 inc/order/class-lp-order.php:508
5551
  msgid "(Guest)"
5552
  msgstr ""
5553
 
5554
- #: inc/custom-post-types/order.php:793
 
5555
  msgid "Course does not exist"
5556
  msgstr ""
5557
 
5558
- #: inc/custom-post-types/order.php:807
 
5559
  msgid "(No item)"
5560
  msgstr ""
5561
 
5562
- #: inc/custom-post-types/order.php:815
5563
  #, php-format
5564
  msgid "Pay via <strong>%s</strong>"
5565
  msgstr ""
5566
 
5567
- #: inc/custom-post-types/order.php:845
5568
  msgid "Add New Order"
5569
  msgstr ""
5570
 
5571
- #: inc/custom-post-types/order.php:846 inc/custom-post-types/order.php:929
5572
  #: templates/order/order-details.php:23
5573
  msgid "Order Details"
5574
  msgstr ""
5575
 
5576
- #: inc/custom-post-types/order.php:850
5577
  msgid "Update Order"
5578
  msgstr ""
5579
 
5580
- #: inc/custom-post-types/order.php:851
5581
  msgid "Search Orders"
5582
  msgstr ""
5583
 
5584
- #: inc/custom-post-types/order.php:852
5585
  msgid "No order found"
5586
  msgstr ""
5587
 
5588
- #: inc/custom-post-types/order.php:853
5589
  msgid "No order found in Trash"
5590
  msgstr ""
5591
 
5592
- #: inc/custom-post-types/order.php:930
5593
  msgid "Order Actions"
5594
  msgstr ""
5595
 
5596
- #: inc/custom-post-types/question.php:145
 
 
 
 
 
5597
  #: inc/updates/_update-from-0.9.php:1216
5598
  msgid "Question Tag"
5599
  msgstr ""
5600
 
5601
- #: inc/custom-post-types/question.php:148
5602
  #: inc/updates/_update-from-0.9.php:1197 inc/updates/_update-from-0.9.php:1219
5603
  msgid "Add New Tag"
5604
  msgstr ""
5605
 
5606
- #: inc/custom-post-types/question.php:149
5607
  #: inc/updates/_update-from-0.9.php:1198 inc/updates/_update-from-0.9.php:1220
5608
  msgid "All Tags"
5609
  msgstr ""
5610
 
5611
- #: inc/custom-post-types/question.php:167
5612
- #: inc/custom-post-types/question.php:168
5613
  msgid "Question Bank"
5614
  msgstr ""
5615
 
5616
- #: inc/custom-post-types/question.php:169
5617
  #: templates/content-quiz/progress.php:43
5618
  msgid "Question"
5619
  msgstr ""
5620
 
5621
- #: inc/custom-post-types/question.php:171
5622
  msgid "View Question"
5623
  msgstr ""
5624
 
5625
- #: inc/custom-post-types/question.php:172
5626
  msgid "Add New Question"
5627
  msgstr ""
5628
 
5629
- #: inc/custom-post-types/question.php:174
5630
  msgid "Edit Question"
5631
  msgstr ""
5632
 
5633
- #: inc/custom-post-types/question.php:175
5634
  msgid "Update Question"
5635
  msgstr ""
5636
 
5637
- #: inc/custom-post-types/question.php:176
5638
  msgid "Search Questions"
5639
  msgstr ""
5640
 
5641
- #: inc/custom-post-types/question.php:177
5642
  msgid "No questions found"
5643
  msgstr ""
5644
 
5645
- #: inc/custom-post-types/question.php:178
5646
  msgid "No questions found in trash"
5647
  msgstr ""
5648
 
@@ -5676,89 +5746,93 @@ msgstr ""
5676
  msgid "No quiz found in Trash"
5677
  msgstr ""
5678
 
5679
- #: inc/custom-post-types/quiz.php:174
5680
  msgid "Option"
5681
  msgstr ""
5682
 
5683
- #: inc/custom-post-types/quiz.php:216
 
 
 
 
5684
  msgid "General Settings"
5685
  msgstr ""
5686
 
5687
- #: inc/custom-post-types/quiz.php:222
5688
- msgid "Show Questions"
5689
  msgstr ""
5690
 
5691
- #: inc/custom-post-types/quiz.php:223
5692
  msgid ""
5693
  "Show list of questions while doing quiz as ordered numbers (1, 2, 3, etc)."
5694
  msgstr ""
5695
 
5696
- #: inc/custom-post-types/quiz.php:229
5697
  msgid "Review Questions"
5698
  msgstr ""
5699
 
5700
- #: inc/custom-post-types/quiz.php:232
5701
  msgid "Allow re-viewing questions after completing quiz."
5702
  msgstr ""
5703
 
5704
- #: inc/custom-post-types/quiz.php:236
5705
  msgid "Show Correct Answer"
5706
  msgstr ""
5707
 
5708
- #: inc/custom-post-types/quiz.php:239
5709
  msgid "Show correct answer when reviewing questions."
5710
  msgstr ""
5711
 
5712
- #: inc/custom-post-types/quiz.php:254
5713
  msgid "Duration of the quiz. Set 0 to disable."
5714
  msgstr ""
5715
 
5716
- #: inc/custom-post-types/quiz.php:262
5717
  msgid "Passing Grade (<span>%</span>)"
5718
  msgstr ""
5719
 
5720
- #: inc/custom-post-types/quiz.php:263
5721
  msgid "Requires user reached this point to pass the quiz."
5722
  msgstr ""
5723
 
5724
- #: inc/custom-post-types/quiz.php:272
5725
  msgid "Re-take"
5726
  msgstr ""
5727
 
5728
- #: inc/custom-post-types/quiz.php:275
5729
  msgid ""
5730
  "How many times the user can re-take this quiz. Set to 0 to disable re-taking"
5731
  msgstr ""
5732
 
5733
- #: inc/custom-post-types/quiz.php:280
5734
  msgid "Archive History"
5735
  msgstr ""
5736
 
5737
- #: inc/custom-post-types/quiz.php:283
5738
  msgid "Archive quiz results for each time."
5739
  msgstr ""
5740
 
5741
- #: inc/custom-post-types/quiz.php:297
5742
  msgid "Show Check Answer"
5743
  msgstr ""
5744
 
5745
- #: inc/custom-post-types/quiz.php:300
5746
  msgid ""
5747
  "Show button to check answer while doing quiz ( 0 = Disabled, -1 = Unlimited, "
5748
  "N = Number of check )."
5749
  msgstr ""
5750
 
5751
- #: inc/custom-post-types/quiz.php:306
5752
  msgid "Show Hint"
5753
  msgstr ""
5754
 
5755
- #: inc/custom-post-types/quiz.php:309
5756
  msgid ""
5757
  "Show button to hint answer while doing quiz ( 0 = Disabled, -1 = Unlimited, "
5758
  "N = Number of check )."
5759
  msgstr ""
5760
 
5761
- #: inc/custom-post-types/quiz.php:388
5762
  msgid "This quiz has no questions"
5763
  msgstr ""
5764
 
@@ -5785,7 +5859,6 @@ msgstr ""
5785
  #: inc/emails/class-lp-email-enrolled-course-admin.php:28
5786
  #: inc/emails/class-lp-email-finished-course-admin.php:28
5787
  #: inc/emails/class-lp-email-new-order-admin.php:27
5788
- #: inc/emails/_bk/class-lp-email-finished-course-admin.php:26
5789
  msgid "Admin"
5790
  msgstr ""
5791
 
@@ -5827,7 +5900,6 @@ msgstr ""
5827
  #: inc/emails/class-lp-email-finished-course-user.php:27
5828
  #: inc/emails/class-lp-email-new-order-user.php:27
5829
  #: inc/emails/class-lp-email-processing-order-user.php:26
5830
- #: inc/emails/_bk/class-lp-email-finished-course-user.php:26
5831
  msgid "User"
5832
  msgstr ""
5833
 
@@ -5928,12 +6000,12 @@ msgid ""
5928
  msgstr ""
5929
 
5930
  #: inc/emails/class-lp-email-new-course.php:137
5931
- #: inc/emails/class-lp-email.php:988
5932
  msgid "Recipient(s)"
5933
  msgstr ""
5934
 
5935
  #: inc/emails/class-lp-email-new-course.php:141
5936
- #: inc/emails/class-lp-email.php:992
5937
  #, php-format
5938
  msgid "Email recipient(s) (separated by comma), default: <code>%s</code>."
5939
  msgstr ""
@@ -5944,10 +6016,7 @@ msgstr ""
5944
  #: inc/emails/class-lp-email-updated-course.php:174
5945
  #: inc/emails/class-lp-email-user-order-changed-status.php:146
5946
  #: inc/emails/class-lp-email-user-order-completed.php:147
5947
- #: inc/emails/class-lp-email.php:1009
5948
- #: inc/emails/_bk/class-lp-email-finished-course-admin.php:141
5949
- #: inc/emails/_bk/class-lp-email-finished-course-instructor.php:143
5950
- #: inc/emails/_bk/class-lp-email-finished-course-user.php:143
5951
  #, php-format
5952
  msgid "Email subject, default: <code>%s</code>."
5953
  msgstr ""
@@ -5958,10 +6027,7 @@ msgstr ""
5958
  #: inc/emails/class-lp-email-updated-course.php:187
5959
  #: inc/emails/class-lp-email-user-order-changed-status.php:159
5960
  #: inc/emails/class-lp-email-user-order-completed.php:160
5961
- #: inc/emails/class-lp-email.php:1022
5962
- #: inc/emails/_bk/class-lp-email-finished-course-admin.php:154
5963
- #: inc/emails/_bk/class-lp-email-finished-course-instructor.php:156
5964
- #: inc/emails/_bk/class-lp-email-finished-course-user.php:156
5965
  msgid "Heading"
5966
  msgstr ""
5967
 
@@ -5971,10 +6037,7 @@ msgstr ""
5971
  #: inc/emails/class-lp-email-updated-course.php:191
5972
  #: inc/emails/class-lp-email-user-order-changed-status.php:163
5973
  #: inc/emails/class-lp-email-user-order-completed.php:164
5974
- #: inc/emails/class-lp-email.php:1026
5975
- #: inc/emails/_bk/class-lp-email-finished-course-admin.php:158
5976
- #: inc/emails/_bk/class-lp-email-finished-course-instructor.php:160
5977
- #: inc/emails/_bk/class-lp-email-finished-course-user.php:160
5978
  #, php-format
5979
  msgid "Email heading, default: <code>%s</code>."
5980
  msgstr ""
@@ -6102,24 +6165,6 @@ msgstr ""
6102
  msgid "Your order {{order_number}} is completed"
6103
  msgstr ""
6104
 
6105
- #: inc/emails/_bk/class-lp-email-finished-course-admin.php:27
6106
- #: inc/emails/_bk/class-lp-email-finished-course-instructor.php:27
6107
- #: inc/emails/_bk/class-lp-email-finished-course-user.php:27
6108
- msgid "Send this email to user when a user finished a course."
6109
- msgstr ""
6110
-
6111
- #: inc/emails/_bk/class-lp-email-finished-course-admin.php:30
6112
- #: inc/emails/_bk/class-lp-email-finished-course-instructor.php:32
6113
- #: inc/emails/_bk/class-lp-email-finished-course-user.php:32
6114
- msgid "[{{site_title}}] You have finished this course ({{course_name}})"
6115
- msgstr ""
6116
-
6117
- #: inc/emails/_bk/class-lp-email-finished-course-admin.php:31
6118
- #: inc/emails/_bk/class-lp-email-finished-course-instructor.php:33
6119
- #: inc/emails/_bk/class-lp-email-finished-course-user.php:33
6120
- msgid "Finished course"
6121
- msgstr ""
6122
-
6123
  #: inc/gateways/class-lp-gateway-abstract.php:244
6124
  msgid "%s has been deprecated. Please use % instead of."
6125
  msgstr ""
@@ -6154,12 +6199,12 @@ msgstr ""
6154
  msgid "Every %d minutes"
6155
  msgstr ""
6156
 
6157
- #: inc/libraries/meta-box/inc/core.php:34
6158
  #: inc/libraries/meta-box/inc/about/sections/getting-started.php:26
6159
  msgid "Extensions"
6160
  msgstr ""
6161
 
6162
- #: inc/libraries/meta-box/inc/field.php:351
6163
  msgid "+ Add more"
6164
  msgstr ""
6165
 
@@ -6262,7 +6307,7 @@ msgstr ""
6262
  msgid "Click me"
6263
  msgstr ""
6264
 
6265
- #: inc/libraries/meta-box/inc/fields/file-input.php:19
6266
  msgid "Select File"
6267
  msgstr ""
6268
 
@@ -6276,38 +6321,38 @@ msgstr ""
6276
  msgid "You may only upload maximum %d files"
6277
  msgstr ""
6278
 
6279
- #: inc/libraries/meta-box/inc/fields/file.php:79
6280
  msgid "Error: Cannot delete file"
6281
  msgstr ""
6282
 
6283
- #: inc/libraries/meta-box/inc/fields/file.php:93
6284
  msgctxt "file upload"
6285
  msgid "+ Add new file"
6286
  msgstr ""
6287
 
6288
- #: inc/libraries/meta-box/inc/fields/file.php:143
6289
  msgctxt "file upload"
6290
  msgid "Delete"
6291
  msgstr ""
6292
 
6293
- #: inc/libraries/meta-box/inc/fields/file.php:144
6294
  msgctxt "file upload"
6295
  msgid "Edit"
6296
  msgstr ""
6297
 
6298
- #: inc/libraries/meta-box/inc/fields/input-list.php:92
6299
  msgid "Select All / None"
6300
  msgstr ""
6301
 
6302
- #: inc/libraries/meta-box/inc/fields/key-value.php:126
6303
  msgid "Key"
6304
  msgstr ""
6305
 
6306
- #: inc/libraries/meta-box/inc/fields/key-value.php:127
6307
  msgid "Value"
6308
  msgstr ""
6309
 
6310
- #: inc/libraries/meta-box/inc/fields/map.php:62
6311
  msgid "Find Address"
6312
  msgstr ""
6313
 
@@ -6365,12 +6410,12 @@ msgstr ""
6365
  msgid "Embed HTML not available."
6366
  msgstr ""
6367
 
6368
- #: inc/libraries/meta-box/inc/fields/post.php:37
6369
  msgid "Select a post"
6370
  msgstr ""
6371
 
6372
- #: inc/libraries/meta-box/inc/fields/post.php:42
6373
- #: inc/libraries/meta-box/inc/fields/taxonomy.php:52
6374
  #, php-format
6375
  msgid "Select a %s"
6376
  msgstr ""
@@ -6383,15 +6428,10 @@ msgstr ""
6383
  msgid "None"
6384
  msgstr ""
6385
 
6386
- #: inc/libraries/meta-box/inc/fields/taxonomy.php:47
6387
  msgid "Select a term"
6388
  msgstr ""
6389
 
6390
- #: inc/libraries/meta-box/inc/fields/thickbox-image.php:55
6391
- msgctxt "image upload"
6392
- msgid "Upload Images"
6393
- msgstr ""
6394
-
6395
  #: inc/libraries/meta-box/inc/fields/user.php:30
6396
  msgid "Select an user"
6397
  msgstr ""
@@ -6549,10 +6589,6 @@ msgstr ""
6549
  msgid "Single Choice"
6550
  msgstr ""
6551
 
6552
- #: inc/question/class-lp-question.php:567
6553
- msgid "New Option"
6554
- msgstr ""
6555
-
6556
  #: inc/question/class-lp-question.php:585
6557
  msgid "First option"
6558
  msgstr ""
@@ -6678,78 +6714,78 @@ msgctxt "Permalink Slug"
6678
  msgid "question-tag"
6679
  msgstr ""
6680
 
6681
- #: inc/user/abstract-lp-user.php:360
6682
  msgid "You cannot start a quiz in preview mode."
6683
  msgstr ""
6684
 
6685
- #: inc/user/abstract-lp-user.php:367
6686
  msgid "Course does not exist or does not contain the quiz"
6687
  msgstr ""
6688
 
6689
- #: inc/user/abstract-lp-user.php:372
6690
  msgid "User has already finished the course of this quiz"
6691
  msgstr ""
6692
 
6693
- #: inc/user/abstract-lp-user.php:378
6694
  msgid "User has started or completed quiz"
6695
  msgstr ""
6696
 
6697
- #: inc/user/abstract-lp-user.php:385
6698
  msgid "You have to login for starting quiz."
6699
  msgstr ""
6700
 
6701
- #: inc/user/abstract-lp-user.php:402
6702
  msgid "Start quiz failed!"
6703
  msgstr ""
6704
 
6705
- #: inc/user/abstract-lp-user.php:439
6706
  msgid "Course is not exists or does not contain the quiz"
6707
  msgstr ""
6708
 
6709
- #: inc/user/abstract-lp-user.php:444
6710
  msgid "User has already finished course of this quiz"
6711
  msgstr ""
6712
 
6713
- #: inc/user/abstract-lp-user.php:450
6714
  msgid "User has completed quiz"
6715
  msgstr ""
6716
 
6717
- #: inc/user/abstract-lp-user.php:492
6718
  msgid "Course does not exist or does not contain the quiz."
6719
  msgstr ""
6720
 
6721
- #: inc/user/abstract-lp-user.php:497
6722
  msgid "You can not redo a quiz in a finished course."
6723
  msgstr ""
6724
 
6725
- #: inc/user/abstract-lp-user.php:503
6726
  #, php-format
6727
  msgid "%s::%s - User has not completed quiz."
6728
  msgstr ""
6729
 
6730
- #: inc/user/abstract-lp-user.php:1082
6731
  msgid "You can not hint question."
6732
  msgstr ""
6733
 
6734
- #: inc/user/abstract-lp-user.php:1549 inc/user/abstract-lp-user.php:1896
6735
- #: inc/user/abstract-lp-user.php:1908
6736
  #, php-format
6737
  msgid "The role %s for user doesn't exist"
6738
  msgstr ""
6739
 
6740
- #: inc/user/abstract-lp-user.php:2215
6741
  msgid "You can not complete a preview lesson."
6742
  msgstr ""
6743
 
6744
- #: inc/user/abstract-lp-user.php:2242
6745
  msgid "You have already completed this lesson"
6746
  msgstr ""
6747
 
6748
- #: inc/user/abstract-lp-user.php:2612 inc/user/abstract-lp-user.php:2616
6749
  msgid "Failed to enroll course."
6750
  msgstr ""
6751
 
6752
- #: inc/user/abstract-lp-user.php:2620
6753
  msgid "Please login to enroll course."
6754
  msgstr ""
6755
 
@@ -6769,7 +6805,7 @@ msgstr ""
6769
  msgid "Account publicity updated successful."
6770
  msgstr ""
6771
 
6772
- #: inc/user/class-lp-profile.php:835 inc/user-item/class-lp-user-item.php:352
6773
  msgid "Not enrolled"
6774
  msgstr ""
6775
 
@@ -6777,92 +6813,97 @@ msgstr ""
6777
  msgid "Every 3 Minutes"
6778
  msgstr ""
6779
 
6780
- #: inc/user/lp-user-functions.php:151
6781
  msgctxt "User role"
6782
  msgid "Instructor"
6783
  msgstr ""
6784
 
6785
- #: inc/user/lp-user-functions.php:360
6786
  msgid "Want to become an instructor?"
6787
  msgstr ""
6788
 
6789
- #: inc/user/lp-user-functions.php:834
6790
  msgid "Only"
6791
  msgstr ""
6792
 
6793
- #: inc/user/lp-user-functions.php:834
6794
  msgid "images accepted for upload"
6795
  msgstr ""
6796
 
6797
- #: inc/user/lp-user-functions.php:843
6798
  msgid "Images must be under"
6799
  msgstr ""
6800
 
6801
- #: inc/user/lp-user-functions.php:843
6802
  msgid "MB in size"
6803
  msgstr ""
6804
 
6805
- #: inc/user/lp-user-functions.php:851
6806
  msgid "Please select an image for upload"
6807
  msgstr ""
6808
 
6809
- #: inc/user/lp-user-functions.php:880
6810
  msgid "Image is uploaded success"
6811
  msgstr ""
6812
 
6813
- #: inc/user/lp-user-functions.php:880
6814
  msgid "Error in uploading image"
6815
  msgstr ""
6816
 
6817
- #: inc/user/lp-user-functions.php:906 inc/user/lp-user-functions.php:937
6818
- #: inc/user/lp-user-functions.php:953 inc/user/lp-user-functions.php:960
6819
  msgid "Thumbnail of image profile not created"
6820
  msgstr ""
6821
 
6822
- #: inc/user/lp-user-functions.php:924
6823
  msgid "Error in cropping user picture profile"
6824
  msgstr ""
6825
 
6826
- #: inc/user/lp-user-functions.php:979
6827
  msgid "Profile picture is changed"
6828
  msgstr ""
6829
 
6830
- #: inc/user/lp-user-functions.php:1023 inc/user/lp-user-functions.php:1510
6831
  msgid "Old password incorrect!"
6832
  msgstr ""
6833
 
6834
- #: inc/user/lp-user-functions.php:1037 inc/user/lp-user-functions.php:1517
6835
  msgid "Confirmation password incorrect!"
6836
  msgstr ""
6837
 
6838
- #: inc/user/lp-user-functions.php:1056
6839
  msgid "Your changes are saved"
6840
  msgstr ""
6841
 
6842
- #: inc/user/lp-user-functions.php:1064
6843
  msgid "Error in update your profile info"
6844
  msgstr ""
6845
 
6846
- #: inc/user/lp-user-functions.php:1198
6847
  msgid "Please login to enroll this course"
6848
  msgstr ""
6849
 
6850
- #: inc/user/lp-user-functions.php:1216
6851
  msgid "You have already finished course"
6852
  msgstr ""
6853
 
6854
- #: inc/user/lp-user-functions.php:1219
6855
  msgid "You have already enrolled in this course"
6856
  msgstr ""
6857
 
6858
- #: inc/user-item/class-lp-user-item-quiz.php:335
6859
  msgid "Check question has reached limit."
6860
  msgstr ""
6861
 
6862
- #: inc/user-item/class-lp-user-item-quiz.php:337
6863
  msgid "You have already checked this question."
6864
  msgstr ""
6865
 
 
 
 
 
 
6866
  #: inc/widgets/course-attributes/course-attributes.php:14
6867
  msgid "Course attributes"
6868
  msgstr ""
@@ -7452,7 +7493,7 @@ msgstr ""
7452
  msgid "Order Number"
7453
  msgstr ""
7454
 
7455
- #: templates/checkout/order-received.php:48 templates/checkout/payment.php:40
7456
  #: templates/emails/order-items-table.php:40
7457
  #: templates/emails/plain/order-items-table.php:28
7458
  msgid "Payment Method"
@@ -7598,17 +7639,17 @@ msgstr ""
7598
  msgid "Hint"
7599
  msgstr ""
7600
 
7601
- #: templates/content-quiz/buttons/nav.php:31
7602
  msgctxt "quiz-question-navigation"
7603
  msgid "Prev"
7604
  msgstr ""
7605
 
7606
- #: templates/content-quiz/buttons/nav.php:51
7607
  msgctxt "quiz-question-navigation"
7608
  msgid "Next"
7609
  msgstr ""
7610
 
7611
- #: templates/content-quiz/buttons/nav.php:71
7612
  msgctxt "quiz-question-navigation"
7613
  msgid "Skip"
7614
  msgstr ""
@@ -7792,7 +7833,7 @@ msgstr ""
7792
  msgid "Passing Grade"
7793
  msgstr ""
7794
 
7795
- #: templates/profile/tabs/courses.php:35 templates/profile/tabs/quizzes.php:39
7796
  #: templates/profile/tabs/courses/purchased.php:41
7797
  msgid "Progress"
7798
  msgstr ""
@@ -7801,11 +7842,11 @@ msgstr ""
7801
  msgid "My Quizzes"
7802
  msgstr ""
7803
 
7804
- #: templates/profile/tabs/quizzes.php:40
7805
  msgid "Interval"
7806
  msgstr ""
7807
 
7808
- #: templates/profile/tabs/quizzes.php:90
7809
  msgid "No quizzes!"
7810
  msgstr ""
7811
 
8
  msgstr ""
9
  "Project-Id-Version: Package Name\n"
10
  "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2018-05-10 10:29+0700\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
18
  "Content-Transfer-Encoding: 8bit\n"
19
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
20
 
21
+ #: learnpress.php:368
22
  #, php-format
23
  msgid ""
24
  "LearnPress plugin base directory must be <strong>learnpress/learnpres.php</"
26
  "operational (currently <strong>%s</strong>)"
27
  msgstr ""
28
 
29
+ #: inc/abstract-settings.php:69
30
+ #: inc/admin/settings/abstract-settings-page.php:49
31
  msgid "No setting available."
32
  msgstr ""
33
 
44
  msgid "The order %s has been successfully recovered."
45
  msgstr ""
46
 
47
+ #: inc/class-lp-ajax.php:246 inc/admin/class-lp-admin-ajax.php:879
48
  msgid "Profile picture upload failed"
49
  msgstr ""
50
 
155
  msgid "Page %d"
156
  msgstr ""
157
 
158
+ #: inc/class-lp-checkout.php:159 inc/class-lp-checkout.php:419
159
  msgid "Please enter your email."
160
  msgstr ""
161
 
162
+ #: inc/class-lp-checkout.php:205
163
  #: inc/shortcodes/class-lp-shortcode-register-form.php:64
164
  #: inc/shortcodes/class-lp-shortcode-register-form.php:66
165
  #: templates/checkout/form-login.php:63
166
  msgid "Username"
167
  msgstr ""
168
 
169
+ #: inc/class-lp-checkout.php:206
170
  #: inc/shortcodes/class-lp-shortcode-login-form.php:69
171
  #: inc/shortcodes/class-lp-shortcode-login-form.php:71
172
  #: inc/shortcodes/class-lp-shortcode-register-form.php:80
175
  msgid "Password"
176
  msgstr ""
177
 
178
+ #: inc/class-lp-checkout.php:262 inc/class-lp-checkout.php:271
179
+ #: inc/class-lp-checkout.php:310
180
  #, php-format
181
  msgid "Error %d: Unable to create order. Please try again."
182
  msgstr ""
183
 
184
+ #: inc/class-lp-checkout.php:304
185
  msgid "Item does not exist!"
186
  msgstr ""
187
 
188
+ #: inc/class-lp-checkout.php:334
189
  msgid "Unable to checkout. Order creation failed."
190
  msgstr ""
191
 
192
+ #: inc/class-lp-checkout.php:410
193
  msgid "Please enter username."
194
  msgstr ""
195
 
196
+ #: inc/class-lp-checkout.php:414
197
  msgid "Please enter user password"
198
  msgstr ""
199
 
200
+ #: inc/class-lp-checkout.php:496
201
  msgid "No payment method is selected"
202
  msgstr ""
203
 
204
+ #: inc/class-lp-checkout.php:536 templates/checkout/empty-cart.php:19
205
  msgid "Your cart is currently empty."
206
  msgstr ""
207
 
208
+ #: inc/class-lp-checkout.php:555
209
  #, php-format
210
  msgid "Item \"%s\" is not purchasable."
211
  msgstr ""
212
 
213
+ #: inc/class-lp-emails.php:134 inc/class-lp-emails.php:141
214
  msgid "Cheatin&#8217; huh?"
215
  msgstr ""
216
 
260
  msgid "Password must include at least one of these characters ~!@#$%^&*() !"
261
  msgstr ""
262
 
263
+ #: inc/class-lp-install.php:489
264
  msgid ""
265
  "It seems like you have updated LearnPress from an older version and there "
266
  "are some outdated courses or data that need to be upgraded."
267
  msgstr ""
268
 
269
+ #: inc/class-lp-install.php:490
270
  msgid "Do not ask again."
271
  msgstr ""
272
 
273
+ #: inc/class-lp-install.php:490
274
  msgid "Ok"
275
  msgstr ""
276
 
277
+ #: inc/class-lp-install.php:490 inc/lp-core-functions.php:2208
278
+ #: inc/admin/class-lp-admin-ajax.php:676 inc/admin/class-lp-admin.php:214
279
+ #: inc/custom-post-types/course.php:856 inc/order/class-lp-order.php:940
280
  #: templates/checkout/form-login.php:103
281
  msgid "Cancel"
282
  msgstr ""
283
 
284
+ #: inc/class-lp-install.php:491
285
  #: inc/admin/views/tools/database/html-upgrade-database.php:17
286
  msgid "Upgrade now"
287
  msgstr ""
288
 
289
+ #: inc/class-lp-install.php:491
290
  msgid "No, thank!"
291
  msgstr ""
292
 
293
+ #: inc/class-lp-install.php:498
294
  msgid ""
295
  "LearnPress has been updated and the database needs to be upgraded before you "
296
  "can work with it. Please notify the site administrator."
297
  msgstr ""
298
 
299
+ #: inc/class-lp-install.php:517
300
  msgid "Thank you for using LearnPress"
301
  msgstr ""
302
 
303
  #: inc/class-lp-multi-language.php:52
 
304
  #: inc/admin/sub-menus/class-lp-submenu-settings.php:14
305
+ #: inc/admin/views/quiz/question-meta.php:12
306
+ #: inc/custom-post-types/question.php:285 inc/user/class-lp-profile.php:325
307
  msgid "Settings"
308
  msgstr ""
309
 
310
+ #: inc/class-lp-multi-language.php:53 inc/libraries/meta-box/inc/core.php:38
311
  msgid "Documentation"
312
  msgstr ""
313
 
326
  msgid "Invalid question!"
327
  msgstr ""
328
 
329
+ #: inc/class-lp-page-controller.php:391
330
  #, php-format
331
  msgid "The user %s is not available!"
332
  msgstr ""
348
  msgid "You are in preview mode. Continue <a href=\"%s\">editing</a>?"
349
  msgstr ""
350
 
351
+ #: inc/class-lp-query-list-table.php:28 inc/custom-post-types/course.php:95
352
  msgid "item"
353
  msgstr ""
354
 
385
  msgid "Invalid action."
386
  msgstr ""
387
 
388
+ #: inc/class-lp-request-handler.php:262 inc/class-lp-request-handler.php:314
389
+ #, php-format
390
+ msgid "You can not enroll course &quot;%s&quot"
391
+ msgstr ""
392
+
393
+ #: inc/class-lp-request-handler.php:284 inc/cart/class-lp-cart.php:459
394
  msgid "Checkout page hasn't been setup"
395
  msgstr ""
396
 
397
+ #: inc/class-lp-request-handler.php:307
398
+ #: inc/course/lp-course-functions.php:1036
399
  msgid "Invalid request!"
400
  msgstr ""
401
 
402
+ #: inc/class-lp-request-handler.php:331
403
  #, php-format
404
  msgid "Congrats! You have enrolled &quot;%s&quot"
405
  msgstr ""
406
 
407
+ #: inc/class-lp-request-handler.php:357
408
  msgid "Checkout page hasn't been setup or page does not exists."
409
  msgstr ""
410
 
411
+ #: inc/class-lp-request-handler.php:359
412
  msgid "Checkout error! Please contact with admin for getting more information."
413
  msgstr ""
414
 
452
 
453
  #: inc/lp-core-functions.php:351 inc/lp-template-functions.php:2653
454
  #: inc/admin/settings/class-lp-settings-courses.php:150
455
+ #: inc/course/lp-course-functions.php:540 inc/custom-post-types/lesson.php:204
456
  msgid "Lesson"
457
  msgstr ""
458
 
459
  #: inc/lp-core-functions.php:352 inc/lp-template-functions.php:2643
460
  #: inc/admin/settings/class-lp-settings-courses.php:157
461
+ #: inc/course/lp-course-functions.php:541
462
+ #: inc/custom-post-types/question.php:328 inc/custom-post-types/quiz.php:92
463
+ #: templates/profile/tabs/quizzes.php:38
464
  msgid "Quiz"
465
  msgstr ""
466
 
1164
  msgstr[0] ""
1165
  msgstr[1] ""
1166
 
1167
+ #: inc/lp-core-functions.php:1497 inc/admin/views/quiz/editor.php:29
1168
+ #: inc/admin/views/tools/course/html-course.php:29
1169
+ #: inc/admin/views/tools/course/html-user.php:29
1170
  msgid "Name"
1171
  msgstr ""
1172
 
1234
  msgid "Your request has been sent! We will get back to you soon!"
1235
  msgstr ""
1236
 
1237
+ #: inc/lp-core-functions.php:2207
1238
  msgid "OK"
1239
  msgstr ""
1240
 
1241
+ #: inc/lp-core-functions.php:2209
1242
+ #: inc/libraries/meta-box/inc/fields/checkbox.php:53
1243
  msgid "Yes"
1244
  msgstr ""
1245
 
1246
+ #: inc/lp-core-functions.php:2210
1247
+ #: inc/libraries/meta-box/inc/fields/checkbox.php:53
1248
  #: templates/content-quiz/intro.php:25
1249
  msgid "No"
1250
  msgstr ""
1251
 
1252
+ #: inc/lp-core-functions.php:2455
1253
  #, php-format
1254
  msgid "Congrats! You've enrolled the course \"%s\"."
1255
  msgstr ""
1256
 
1257
+ #: inc/lp-core-functions.php:2488
1258
  msgid "Cart"
1259
  msgstr ""
1260
 
1261
+ #: inc/lp-core-functions.php:2492
1262
  msgid "Enable cart"
1263
  msgstr ""
1264
 
1265
+ #: inc/lp-core-functions.php:2493
1266
  msgid "Check this option to enable user purchase multiple courses at one time."
1267
  msgstr ""
1268
 
1269
+ #: inc/lp-core-functions.php:2499
1270
  msgid "Add to cart redirect"
1271
  msgstr ""
1272
 
1273
+ #: inc/lp-core-functions.php:2500
1274
  msgid "Redirect to checkout immediately after adding course to cart."
1275
  msgstr ""
1276
 
1277
+ #: inc/lp-core-functions.php:2506
1278
  msgid "AJAX add to cart"
1279
  msgstr ""
1280
 
1281
+ #: inc/lp-core-functions.php:2507
1282
  msgid "Using AJAX to add course to cart."
1283
  msgstr ""
1284
 
1285
+ #: inc/lp-core-functions.php:2513
1286
  msgid "Cart page"
1287
  msgstr ""
1288
 
1289
+ #: inc/lp-core-functions.php:2651
1290
  msgid "Are you sure you want to cancel order?"
1291
  msgstr ""
1292
 
1293
+ #: inc/lp-core-functions.php:2652
1294
  msgid "Cancel Order"
1295
  msgstr ""
1296
 
1297
+ #: inc/lp-core-functions.php:2707 inc/course/lp-course-functions.php:936
1298
  #: inc/user/class-lp-profile.php:833 inc/user/class-lp-profile.php:867
1299
  #: inc/user-item/class-lp-user-item.php:344
1300
  msgid "Passed"
1301
  msgstr ""
1302
 
1303
+ #: inc/lp-core-functions.php:2710 inc/course/lp-course-functions.php:939
1304
  #: inc/user/class-lp-profile.php:834 inc/user/class-lp-profile.php:868
1305
  #: inc/user-item/class-lp-user-item.php:345
1306
  msgid "Failed"
1307
  msgstr ""
1308
 
1309
+ #: inc/lp-core-functions.php:2900
1310
  msgctxt "static-page-name"
1311
  msgid "Checkout"
1312
  msgstr ""
1313
 
1314
+ #: inc/lp-core-functions.php:2901
1315
  msgctxt "static-page-name"
1316
  msgid "Courses"
1317
  msgstr ""
1318
 
1319
+ #: inc/lp-core-functions.php:2902
1320
  msgctxt "static-page-name"
1321
  msgid "Profile"
1322
  msgstr ""
1323
 
1324
+ #: inc/lp-core-functions.php:2903
1325
  msgctxt "static-page-name"
1326
  msgid "Become a Teacher"
1327
  msgstr ""
1328
 
1329
  #: inc/lp-deprecated.php:370 inc/lp-deprecated.php:402
1330
+ #: inc/admin/lp-admin-actions.php:59 inc/admin/lp-admin-functions.php:835
1331
+ #: inc/admin/lp-admin-functions.php:1000 inc/admin/lp-admin-functions.php:1202
1332
+ #: inc/admin/lp-admin-functions.php:2083
1333
  #: inc/admin/views/statistics/courses.php:27
1334
  #: inc/admin/views/statistics/courses.php:42
1335
  #: inc/admin/views/statistics/general.php:43
1349
  msgid "Learning"
1350
  msgstr ""
1351
 
1352
+ #: inc/lp-deprecated.php:372 inc/custom-post-types/order.php:716
1353
  #: inc/user/class-lp-profile.php:284
1354
  msgid "Purchased"
1355
  msgstr ""
1364
  msgid "Owned"
1365
  msgstr ""
1366
 
1367
+ #: inc/lp-deprecated.php:403 inc/course/lp-course-functions.php:942
1368
+ #: inc/user-item/class-lp-user-item.php:338
1369
  #: inc/user-item/class-lp-user-item.php:339
1370
  #: inc/user-item/class-lp-user-item.php:340
 
1371
  msgid "In Progress"
1372
  msgstr ""
1373
 
1392
  #: inc/emails/class-lp-email-enrolled-course-instructor.php:27
1393
  #: inc/emails/class-lp-email-finished-course-instructor.php:27
1394
  #: inc/emails/class-lp-email-new-order-instructor.php:26
 
1395
  #: templates/single-course/tabs/instructor.php:22
1396
  msgid "Instructor"
1397
  msgstr ""
1401
  msgstr ""
1402
 
1403
  #: inc/lp-template-functions.php:1304 inc/admin/class-lp-admin.php:276
1404
+ #: inc/admin/lp-admin-actions.php:213
1405
  #: inc/admin/settings/class-lp-settings-courses.php:12
1406
+ #: inc/admin/settings/class-lp-settings-profile.php:149
1407
+ #: inc/admin/settings/class-lp-settings-profile.php:274
1408
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:21
1409
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:28
1410
  #: inc/admin/views/setup/steps/pages.php:22
1411
+ #: inc/admin/views/tools/course/html-user.php:30
1412
+ #: inc/custom-post-types/course.php:123 inc/custom-post-types/course.php:125
1413
  #: inc/user/class-lp-profile.php:299
1414
  msgid "Courses"
1415
  msgstr ""
1444
  msgid "Final"
1445
  msgstr ""
1446
 
1447
+ #: inc/lp-template-functions.php:2656 inc/course/lp-course-functions.php:836
1448
+ #: inc/custom-post-types/abstract.php:777 inc/custom-post-types/lesson.php:339
 
1449
  #: templates/single-course/section/item-meta.php:25
1450
  msgid "Preview"
1451
  msgstr ""
1454
  msgid "Fill out the form and send us your requesting."
1455
  msgstr ""
1456
 
1457
+ #: inc/lp-template-functions.php:3199 inc/custom-post-types/quiz.php:385
1458
  #, php-format
1459
  msgid "%d question"
1460
  msgid_plural "%d questions"
1485
  msgid "%s sec"
1486
  msgstr ""
1487
 
1488
+ #: inc/lp-template-functions.php:3225 inc/course/lp-course-functions.php:757
1489
  msgid "Edit this item"
1490
  msgstr ""
1491
 
1593
  msgstr ""
1594
 
1595
  #: inc/abstracts/abstract-shortcode-courses.php:142
1596
+ #: inc/admin/views/tools/course/html-course.php:53
1597
  #: templates/content-archive-course.php:74
1598
  msgid "No course found."
1599
  msgstr ""
1600
 
1601
+ #: inc/admin/class-lp-admin-ajax.php:201
1602
  msgid "Ops! ID not found"
1603
  msgstr ""
1604
 
1605
+ #: inc/admin/class-lp-admin-ajax.php:230
1606
  msgid "Duplicate post fail, please try again"
1607
  msgstr ""
1608
 
1609
+ #: inc/admin/class-lp-admin-ajax.php:380
1610
  msgid "Access denied"
1611
  msgstr ""
1612
 
1613
+ #: inc/admin/class-lp-admin-ajax.php:392 inc/admin/class-lp-admin-ajax.php:438
1614
  #: templates/order/order-details.php:18
1615
  msgid "Invalid order"
1616
  msgstr ""
1617
 
1618
+ #: inc/admin/class-lp-admin-ajax.php:426
1619
  msgid "Permission denied"
1620
  msgstr ""
1621
 
1622
+ #: inc/admin/class-lp-admin-ajax.php:625 inc/admin/class-lp-admin-ajax.php:798
1623
  #: inc/admin/lp-admin-functions.php:253
1624
  msgid "Edit Page"
1625
  msgstr ""
1626
 
1627
+ #: inc/admin/class-lp-admin-ajax.php:626 inc/admin/class-lp-admin-ajax.php:800
1628
  #: inc/admin/lp-admin-functions.php:255
1629
  msgid "View Page"
1630
  msgstr ""
1631
 
1632
+ #: inc/admin/class-lp-admin-ajax.php:628
1633
  msgid "Error! Page creation failed. Please try again."
1634
  msgstr ""
1635
 
1636
+ #: inc/admin/class-lp-admin-ajax.php:631
1637
  msgid "Empty page name!"
1638
  msgstr ""
1639
 
1640
+ #: inc/admin/class-lp-admin-ajax.php:665
1641
  msgid "The required pages are successfully created."
1642
  msgstr ""
1643
 
1644
+ #: inc/admin/class-lp-admin-ajax.php:675
1645
  msgid "Please try again."
1646
  msgstr ""
1647
 
1648
+ #: inc/admin/class-lp-admin-ajax.php:701
1649
  msgid "Successfully import sample data."
1650
  msgstr ""
1651
 
1652
+ #: inc/admin/class-lp-admin-ajax.php:701
1653
  msgid "View courses"
1654
  msgstr ""
1655
 
1656
+ #: inc/admin/class-lp-admin-ajax.php:705
1657
  msgid "Failed to import sample data. Please try again."
1658
  msgstr ""
1659
 
1660
+ #: inc/admin/class-lp-admin-ajax.php:709
1661
  msgid ""
1662
  "Unknown error when installing/activating Import/Export add-on. Please try "
1663
  "again!"
1664
  msgstr ""
1665
 
1666
+ #: inc/admin/class-lp-admin-ajax.php:725 inc/admin/class-lp-admin-ajax.php:746
1667
+ #: inc/admin/class-lp-admin-ajax.php:766
1668
  msgid "You do not have the permission to deactivate plugins on this site."
1669
  msgstr ""
1670
 
1723
  msgid "Learning Management System"
1724
  msgstr ""
1725
 
1726
+ #: inc/admin/class-lp-admin-menu.php:90 inc/admin/class-lp-admin.php:93
1727
+ #: inc/admin/class-lp-admin.php:101 inc/admin/lp-admin-functions.php:1582
1728
+ #: inc/admin/settings/class-lp-settings-emails.php:161
 
1729
  msgid "LearnPress"
1730
  msgstr ""
1731
 
1745
  msgid "Cart Page"
1746
  msgstr ""
1747
 
1748
+ #: inc/admin/class-lp-admin.php:187 inc/admin/class-lp-admin.php:583
1749
  msgid "Checkout Page"
1750
  msgstr ""
1751
 
1838
  msgid "User has accepted to become a teacher."
1839
  msgstr ""
1840
 
1841
+ #: inc/admin/class-lp-admin.php:557
1842
  #, php-format
1843
  msgid ""
1844
  "LearnPress requires permalink option <strong>Post name</strong> is enabled. "
1846
  "properly."
1847
  msgstr ""
1848
 
1849
+ #: inc/admin/class-lp-admin.php:579
1850
  msgid "Profile Page"
1851
  msgstr ""
1852
 
1853
+ #: inc/admin/class-lp-admin.php:609
1854
  #, php-format
1855
  msgid "The following required page(s) are currently missing: %s."
1856
  msgstr ""
1857
 
1858
+ #: inc/admin/class-lp-admin.php:610
1859
  #, php-format
1860
  msgid ""
1861
  "To ensure all functions work properly, please click <a class=\"button\" id="
1863
  "automatically."
1864
  msgstr ""
1865
 
1866
+ #: inc/admin/class-lp-admin.php:660
1867
  #, php-format
1868
  msgid ""
1869
  "If you like <strong>LearnPress</strong> please leave us a %s&#9733;&#9733;"
1871
  "generous."
1872
  msgstr ""
1873
 
1874
+ #: inc/admin/class-lp-admin.php:660
1875
  msgid "Thanks :)"
1876
  msgstr ""
1877
 
1892
  #: inc/admin/views/meta-boxes/course/assigned.php:22
1893
  #: inc/admin/views/meta-boxes/quiz/assigned.php:28
1894
  #: inc/admin/views/meta-boxes/quiz/assigned.php:38
1895
+ #: inc/custom-post-types/abstract.php:582
1896
+ #: inc/custom-post-types/abstract.php:756
1897
+ #: inc/custom-post-types/abstract.php:765
1898
+ #: inc/custom-post-types/question.php:367 inc/order/class-lp-order.php:933
1899
  msgid "View"
1900
  msgstr ""
1901
 
1902
  #: inc/admin/class-lp-install-sample-data.php:132
1903
+ #: inc/attributes/course.php:232 inc/custom-post-types/abstract.php:580
1904
+ #: inc/custom-post-types/question.php:365
1905
  #: templates/content-lesson/no-content.php:22
1906
  msgid "Edit"
1907
  msgstr ""
1923
 
1924
  #: inc/admin/class-lp-modal-search-items.php:58
1925
  #: inc/admin/class-lp-modal-search-users.php:49
1926
+ #: inc/admin/views/course/modal-choose-items.php:100
1927
+ #: inc/admin/views/quiz/modal-choose-items.php:88
1928
  msgid "Add"
1929
  msgstr ""
1930
 
1931
  #: inc/admin/class-lp-modal-search-items.php:59
1932
  #: inc/admin/class-lp-modal-search-users.php:50
1933
+ #: inc/admin/views/course/modal-choose-items.php:71
1934
+ #: inc/admin/views/meta-boxes/order/details.php:243
1935
+ #: inc/admin/views/quiz/modal-choose-items.php:58
1936
  msgid "Close"
1937
  msgstr ""
1938
 
2043
  msgstr ""
2044
 
2045
  #: inc/admin/class-lp-plugin-install-list-table.php:455
2046
+ #: inc/custom-post-types/order.php:784
2047
  #, php-format
2048
  msgid "%s ago"
2049
  msgstr ""
2073
  msgid "<strong>Compatible</strong> with your version of WordPress"
2074
  msgstr ""
2075
 
2076
+ #: inc/admin/class-lp-reset-data.php:90
2077
+ msgid "Item progress deleted"
2078
  msgstr ""
2079
 
2080
+ #: inc/admin/class-lp-reset-data.php:92
2081
  msgid "No data found"
2082
  msgstr ""
2083
 
2126
  #: inc/admin/class-lp-setup-wizard.php:221
2127
  #: inc/admin/meta-box/fields/payment-order.php:29
2128
  #: inc/admin/views/setup/steps/payment.php:16
2129
+ #: inc/custom-post-types/course.php:759
2130
  msgid "Payment"
2131
  msgstr ""
2132
 
2133
  #: inc/admin/class-lp-setup-wizard.php:225
2134
  #: inc/admin/settings/class-lp-settings-emails.php:26
2135
+ #: inc/admin/settings/class-lp-settings-emails.php:166
2136
  msgid "Emails"
2137
  msgstr ""
2138
 
2152
  msgid "Enter your Paypal email address to accept payment via Paypal."
2153
  msgstr ""
2154
 
 
 
 
 
 
 
 
 
 
2155
  #: inc/admin/class-lp-upgrader.php:12
2156
  msgid "Invalid Data provided."
2157
  msgstr ""
2217
  msgid "Disabling Maintenance mode&#8230;"
2218
  msgstr ""
2219
 
2220
+ #: inc/admin/lp-admin-actions.php:60
2221
  #: inc/admin/views/dashboard/plugin-status/html-results.php:31
2222
  msgid "Published"
2223
  msgstr ""
2224
 
2225
+ #: inc/admin/lp-admin-actions.php:61
2226
  msgid "Private"
2227
  msgstr ""
2228
 
2229
+ #: inc/admin/lp-admin-actions.php:62
2230
  msgid "Pending Review"
2231
  msgstr ""
2232
 
2233
+ #: inc/admin/lp-admin-actions.php:63
2234
  msgid "Scheduled"
2235
  msgstr ""
2236
 
2237
+ #: inc/admin/lp-admin-actions.php:64
2238
  msgid "Draft"
2239
  msgstr ""
2240
 
2241
+ #: inc/admin/lp-admin-actions.php:65
2242
  msgid "Trash"
2243
  msgstr ""
2244
 
2245
+ #: inc/admin/lp-admin-actions.php:143
2246
  msgid "LearnPress Plugin"
2247
  msgstr ""
2248
 
2249
+ #: inc/admin/lp-admin-actions.php:147
2250
  msgid "LearnPress Status"
2251
  msgstr ""
2252
 
2253
+ #: inc/admin/lp-admin-actions.php:219 inc/custom-post-types/course.php:1291
2254
  msgid "Categories"
2255
  msgstr ""
2256
 
2257
+ #: inc/admin/lp-admin-actions.php:224 inc/custom-post-types/course.php:215
2258
  msgid "Tags"
2259
  msgstr ""
2260
 
2263
  msgstr ""
2264
 
2265
  #: inc/admin/lp-admin-functions.php:44
2266
+ #: inc/admin/meta-box/fields/course-permalink.php:47
2267
  #: inc/admin/sub-menus/class-lp-submenu-tools.php:22
2268
  #: inc/admin/views/settings/fields/course-permalink.php:31
2269
  #: inc/admin/views/statistics/orders.php:47
2270
+ #: inc/custom-post-types/abstract.php:556
2271
  #: templates/checkout/review-order.php:32
2272
  #: templates/emails/order-items-table.php:57
2273
  #: templates/order/order-details.php:28 templates/profile/tabs/courses.php:32
2274
+ #: templates/profile/tabs/quizzes.php:37
2275
  #: templates/profile/tabs/courses/purchased.php:38
2276
  msgid "Course"
2277
  msgstr ""
2320
  msgid "Minutes"
2321
  msgstr ""
2322
 
2323
+ #: inc/admin/lp-admin-functions.php:376 inc/admin/lp-admin-functions.php:417
2324
  msgid "Plain text"
2325
  msgstr ""
2326
 
2327
+ #: inc/admin/lp-admin-functions.php:377 inc/admin/lp-admin-functions.php:418
2328
+ #: inc/admin/settings/class-lp-settings-emails.php:147
2329
  msgid "HTML"
2330
  msgstr ""
2331
 
2332
+ #: inc/admin/lp-admin-functions.php:561
2333
  #: inc/admin/views/addons/html-loop-theme.php:51
2334
  msgid "Get it now"
2335
  msgstr ""
2336
 
2337
+ #: inc/admin/lp-admin-functions.php:563
2338
  #: inc/admin/views/addons/html-loop-theme.php:53
2339
  msgid "View Demo"
2340
  msgstr ""
2341
 
2342
+ #: inc/admin/lp-admin-functions.php:840
2343
  #: inc/admin/views/statistics/courses.php:9
2344
  #: inc/admin/views/statistics/general.php:9
2345
  #: inc/admin/views/statistics/orders.php:9
2348
  msgid "Instructors"
2349
  msgstr ""
2350
 
2351
+ #: inc/admin/lp-admin-functions.php:845
2352
  #: inc/admin/views/statistics/courses.php:8
2353
  #: inc/admin/views/statistics/general.php:8
2354
  #: inc/admin/views/statistics/orders.php:8
2355
  #: inc/admin/views/statistics/users.php:8
2356
  #: inc/admin/views/statistics/users.php:47
2357
+ #: inc/admin/views/tools/course/html-course.php:30
2358
+ #: inc/custom-post-types/course.php:1280 inc/custom-post-types/course.php:1287
2359
  msgid "Students"
2360
  msgstr ""
2361
 
2362
+ #: inc/admin/lp-admin-functions.php:1005 inc/admin/lp-admin-functions.php:2088
2363
  #: inc/admin/views/meta-boxes/course/review-logs.php:25
2364
  #: inc/user/class-lp-profile.php:800
2365
  msgid "Publish"
2366
  msgstr ""
2367
 
2368
+ #: inc/admin/lp-admin-functions.php:1010 inc/admin/lp-admin-functions.php:1212
2369
+ #: inc/admin/lp-admin-functions.php:2093
2370
  #: inc/admin/views/statistics/courses.php:44
2371
  #: inc/admin/views/statistics/general.php:61
2372
  #: inc/admin/views/statistics/orders.php:64 inc/user/class-lp-profile.php:801
2373
  msgid "Pending"
2374
  msgstr ""
2375
 
2376
+ #: inc/admin/lp-admin-functions.php:1015 inc/admin/lp-admin-functions.php:2098
2377
  #: inc/admin/views/statistics/courses.php:45
2378
  #: inc/admin/views/statistics/general.php:62
2379
  msgid "Paid"
2380
  msgstr ""
2381
 
2382
+ #: inc/admin/lp-admin-functions.php:1020 inc/admin/lp-admin-functions.php:2103
2383
  #: inc/admin/views/statistics/courses.php:46
2384
  #: inc/admin/views/statistics/general.php:63
2385
+ #: inc/course/abstract-course.php:724 inc/custom-post-types/course.php:1368
2386
  msgid "Free"
2387
  msgstr ""
2388
 
2389
+ #: inc/admin/lp-admin-functions.php:1207
2390
  #: inc/admin/views/statistics/orders.php:63
2391
  #: inc/user-item/class-lp-user-item.php:342
2392
  #: templates/content-lesson/button-complete.php:36
2393
  msgid "Completed"
2394
  msgstr ""
2395
 
2396
+ #: inc/admin/lp-admin-functions.php:1239
2397
  msgid "Pending Courses / Publish Courses"
2398
  msgstr ""
2399
 
2400
+ #: inc/admin/lp-admin-functions.php:1240
2401
  msgid "Free Courses / Priced Courses"
2402
  msgstr ""
2403
 
2404
+ #: inc/admin/lp-admin-functions.php:1408
2405
  msgid "Installed"
2406
  msgstr ""
2407
 
2408
+ #: inc/admin/lp-admin-functions.php:1441
2409
  #, php-format
2410
  msgid "The user %s has become a teacher"
2411
  msgstr ""
2412
 
2413
+ #: inc/admin/lp-admin-functions.php:1499
2414
  msgid "You haven't got any courses yet! Would you like to import sample data?"
2415
  msgstr ""
2416
 
2417
+ #: inc/admin/lp-admin-functions.php:1500
2418
  msgid "If yes, please install add-on name"
2419
  msgstr ""
2420
 
2421
+ #: inc/admin/lp-admin-functions.php:1501
2422
  msgid "LearnPress Import/Export"
2423
  msgstr ""
2424
 
2425
+ #: inc/admin/lp-admin-functions.php:1502
2426
  msgid "but don't worry because it is completely automated."
2427
  msgstr ""
2428
 
2429
+ #: inc/admin/lp-admin-functions.php:1503
2430
  msgid "Import now"
2431
  msgstr ""
2432
 
2433
+ #: inc/admin/lp-admin-functions.php:1504
2434
  msgid "No, thanks!"
2435
  msgstr ""
2436
 
2437
+ #: inc/admin/lp-admin-functions.php:1714
2438
  msgid " Copy"
2439
  msgstr ""
2440
 
2441
+ #: inc/admin/lp-admin-functions.php:1807
2442
  #, php-format
2443
  msgid "Question id %s does not exist."
2444
  msgstr ""
2445
 
2446
+ #: inc/admin/lp-admin-functions.php:1810
2447
  #, php-format
2448
  msgid "Quiz id %s does not exist."
2449
  msgstr ""
2468
  msgstr ""
2469
 
2470
  #: inc/admin/editor/class-lp-admin-editor-quiz.php:150
2471
+ #: inc/admin/editor/class-lp-admin-editor-quiz.php:585
2472
  msgid "Quiz creation failed."
2473
  msgstr ""
2474
 
2513
 
2514
  #: inc/admin/meta-box/fields/color-schema.php:101
2515
  #: inc/admin/sub-menus/class-lp-submenu-settings.php:100
 
2516
  #: inc/admin/views/tools/course/html-user-item.php:28
 
2517
  #: inc/widgets/course-filters/tmpl/default.php:85
2518
  msgid "Reset"
2519
  msgstr ""
2530
  msgid "Delete"
2531
  msgstr ""
2532
 
2533
+ #: inc/admin/meta-box/fields/course-permalink.php:36
2534
+ #: inc/admin/settings/class-lp-settings-courses.php:38
2535
  #: inc/admin/views/settings/fields/course-permalink.php:14
2536
  msgctxt "default-slug"
2537
  msgid "courses"
2538
  msgstr ""
2539
 
2540
+ #: inc/admin/meta-box/fields/course-permalink.php:37
2541
  #: inc/admin/views/settings/fields/course-permalink.php:15
2542
  msgctxt "default-slug"
2543
  msgid "course"
2544
  msgstr ""
2545
 
2546
+ #: inc/admin/meta-box/fields/course-permalink.php:42
2547
  #: inc/admin/views/settings/fields/course-permalink.php:26
2548
  msgid "Default"
2549
  msgstr ""
2550
 
2551
+ #: inc/admin/meta-box/fields/course-permalink.php:52
2552
  #: inc/admin/views/settings/fields/course-permalink.php:36
2553
  msgid "Courses base"
2554
  msgstr ""
2555
 
2556
+ #: inc/admin/meta-box/fields/course-permalink.php:57
2557
  #: inc/admin/views/settings/fields/course-permalink.php:41
2558
  msgid "Courses base with category"
2559
  msgstr ""
2560
 
2561
+ #: inc/admin/meta-box/fields/course-permalink.php:92
2562
  #: inc/admin/views/settings/fields/course-permalink.php:77
2563
  msgid "Custom Base"
2564
  msgstr ""
2565
 
2566
+ #: inc/admin/meta-box/fields/course-permalink.php:100
2567
  #: inc/admin/views/settings/fields/course-permalink.php:84
2568
  msgid ""
2569
  "Enter a custom base to use. A base <strong>must</strong> be set or WordPress "
2570
  "will use default values instead."
2571
  msgstr ""
2572
 
2573
+ #: inc/admin/meta-box/fields/email-content.php:66
2574
+ msgid "General setting"
2575
+ msgstr ""
2576
+
2577
+ #: inc/admin/meta-box/fields/email-content.php:70
2578
+ #, php-format
2579
+ msgid ""
2580
+ "Choose <strong>General setting</strong> to apply the setting from Email <a "
2581
+ "href=\"%s\">General Options</a> "
2582
+ msgstr ""
2583
+
2584
+ #: inc/admin/meta-box/fields/email-content.php:115
2585
  #: inc/admin/views/settings/emails/email-template.php:52
2586
  #, php-format
2587
  msgid ""
2589
  "%s</code>. <br />Please open the file in an editor program to edit"
2590
  msgstr ""
2591
 
2592
+ #: inc/admin/meta-box/fields/email-content.php:151
2593
  #: inc/admin/views/settings/emails/email-template.php:77
2594
  msgid "Click on variables to add it into email content."
2595
  msgstr ""
2624
  #: inc/admin/meta-box/fields/list-emails.php:30
2625
  #: inc/admin/meta-box/fields/payment-order.php:32
2626
  #: inc/admin/views/meta-boxes/order/details.php:58
2627
+ #: inc/custom-post-types/order.php:719
2628
  #: templates/emails/order-items-table.php:44
2629
  #: templates/emails/plain/order-items-table.php:30
2630
  #: templates/profile/tabs/orders/list.php:34
2631
  msgid "Status"
2632
  msgstr ""
2633
 
2634
+ #: inc/admin/meta-box/fields/list-emails.php:70
2635
  msgid ""
2636
  "You can enable/disable each email by clicking on the status icon or apply "
2637
  "status for all emails by clicking these buttons"
2638
  msgstr ""
2639
 
2640
+ #: inc/admin/meta-box/fields/list-emails.php:73
2641
  msgid "Enable all"
2642
  msgstr ""
2643
 
2644
+ #: inc/admin/meta-box/fields/list-emails.php:76
2645
  msgid "Disable all"
2646
  msgstr ""
2647
 
2648
  #: inc/admin/meta-box/fields/payment-order.php:30
2649
+ #: inc/admin/views/tools/course/html-course.php:28
2650
+ #: inc/admin/views/tools/course/html-user.php:28
2651
  msgid "ID"
2652
  msgstr ""
2653
 
2729
  #: inc/admin/settings/class-lp-settings-general.php:16
2730
  #: inc/admin/settings/class-lp-settings-general.php:40
2731
  #: inc/admin/settings/class-lp-settings-payments.php:55
2732
+ #: inc/admin/settings/class-lp-settings-profile.php:54
2733
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:26
2734
+ #: inc/custom-post-types/course.php:570 inc/user/class-lp-profile.php:330
2735
  msgid "General"
2736
  msgstr ""
2737
 
2755
  msgstr ""
2756
 
2757
  #: inc/admin/settings/class-lp-settings-courses.php:24
2758
+ #: inc/custom-post-types/course.php:136
2759
  msgctxt "slug"
2760
  msgid "courses"
2761
  msgstr ""
2762
 
2763
  #: inc/admin/settings/class-lp-settings-courses.php:68
2764
  #: inc/admin/settings/class-lp-settings-general.php:42
2765
+ #: inc/admin/settings/class-lp-settings-profile.php:56
2766
  msgid "General settings."
2767
  msgstr ""
2768
 
2798
  msgstr ""
2799
 
2800
  #: inc/admin/settings/class-lp-settings-courses.php:110
2801
+ #: inc/admin/settings/class-lp-settings-profile.php:109
2802
+ msgid "Courses per page"
2803
  msgstr ""
2804
 
2805
  #: inc/admin/settings/class-lp-settings-courses.php:111
2807
  msgstr ""
2808
 
2809
  #: inc/admin/settings/class-lp-settings-courses.php:126
 
2810
  msgid "Single course"
2811
  msgstr ""
2812
 
2843
  msgid "Thumbnail generation for archive/single course."
2844
  msgstr ""
2845
 
2846
+ #: inc/admin/settings/class-lp-settings-courses.php:202
2847
+ msgid "Archive course"
2848
+ msgstr ""
2849
+
2850
  #: inc/admin/settings/class-lp-settings-courses.php:206
2851
  msgid "Turn on/off courses extra thumbnail."
2852
  msgstr ""
2853
 
 
2854
  #: inc/admin/settings/class-lp-settings-courses.php:209
2855
  msgid "Thumbnail dimensions"
2856
  msgstr ""
2857
 
 
 
 
 
2858
  #: inc/admin/settings/class-lp-settings-emails.php:64
2859
  msgid "General options"
2860
  msgstr ""
2891
  msgstr ""
2892
 
2893
  #: inc/admin/settings/class-lp-settings-emails.php:140
2894
+ msgid "Default Email Content"
2895
+ msgstr ""
2896
+
2897
+ #: inc/admin/settings/class-lp-settings-emails.php:144
2898
+ msgid ""
2899
+ "Default email content type for all emails that set content type is "
2900
+ "<strong>General Settings</strong>."
2901
+ msgstr ""
2902
+
2903
+ #: inc/admin/settings/class-lp-settings-emails.php:146
2904
+ msgid "Plain Text"
2905
+ msgstr ""
2906
+
2907
+ #: inc/admin/settings/class-lp-settings-emails.php:151
2908
  #: inc/admin/views/settings/emails/general.php:40
2909
  msgid "Header image"
2910
  msgstr ""
2911
 
2912
+ #: inc/admin/settings/class-lp-settings-emails.php:156
2913
  #: inc/admin/views/settings/emails/general.php:43
2914
  msgid "The image will be displayed in the top of the email."
2915
  msgstr ""
2916
 
2917
+ #: inc/admin/settings/class-lp-settings-emails.php:159
2918
  #: inc/admin/views/settings/emails/general.php:47
2919
  msgid "Footer text"
2920
  msgstr ""
2921
 
2922
+ #: inc/admin/settings/class-lp-settings-emails.php:163
2923
  msgid "The texts display in the bottom of email."
2924
  msgstr ""
2925
 
3029
  msgid "Payment order"
3030
  msgstr ""
3031
 
3032
+ #: inc/admin/settings/class-lp-settings-profile.php:59
3033
  msgid "Profile page"
3034
  msgstr ""
3035
 
3036
+ #: inc/admin/settings/class-lp-settings-profile.php:65
3037
  msgid "Add link to admin bar"
3038
  msgstr ""
3039
 
3040
+ #: inc/admin/settings/class-lp-settings-profile.php:71
3041
  msgid "Text link"
3042
  msgstr ""
3043
 
3044
+ #: inc/admin/settings/class-lp-settings-profile.php:76
3045
  msgid "If empty, please enter the name of the page used for profile."
3046
  msgstr ""
3047
 
3048
+ #: inc/admin/settings/class-lp-settings-profile.php:89
3049
  msgid "Target link"
3050
  msgstr ""
3051
 
3052
+ #: inc/admin/settings/class-lp-settings-profile.php:94
3053
  msgid "Open in same the window"
3054
  msgstr ""
3055
 
3056
+ #: inc/admin/settings/class-lp-settings-profile.php:95
3057
  msgid "Open in a new window"
3058
  msgstr ""
3059
 
3060
+ #: inc/admin/settings/class-lp-settings-profile.php:114
3061
  msgid "Number of courses displayed per page in profile."
3062
  msgstr ""
3063
 
3064
+ #: inc/admin/settings/class-lp-settings-profile.php:117
3065
  msgid "Enable login form"
3066
  msgstr ""
3067
 
3068
+ #: inc/admin/settings/class-lp-settings-profile.php:121
3069
  msgid "Enable login from profile if the user is not logged in."
3070
  msgstr ""
3071
 
3072
+ #: inc/admin/settings/class-lp-settings-profile.php:124
3073
  msgid "Enable register form"
3074
  msgstr ""
3075
 
3076
+ #: inc/admin/settings/class-lp-settings-profile.php:128
3077
  msgid "Enable register from profile if the user is not logged in."
3078
  msgstr ""
3079
 
3080
+ #: inc/admin/settings/class-lp-settings-profile.php:136
3081
+ msgid "Sub Tab Slugs"
3082
  msgstr ""
3083
 
3084
+ #: inc/admin/settings/class-lp-settings-profile.php:138
3085
  msgid "The slugs of tabs display in profile page. Each tab should be unique."
3086
  msgstr ""
3087
 
3088
+ #: inc/admin/settings/class-lp-settings-profile.php:141
3089
  #: inc/admin/views/updates/0.9/step-upgraded.php:16
3090
  #: inc/user/class-lp-profile.php:293
3091
  msgid "Dashboard"
3092
  msgstr ""
3093
 
3094
+ #: inc/admin/settings/class-lp-settings-profile.php:146
3095
+ #: inc/admin/settings/class-lp-settings-profile.php:154
3096
+ #: inc/admin/settings/class-lp-settings-profile.php:162
3097
+ #: inc/admin/settings/class-lp-settings-profile.php:170
3098
+ #: inc/admin/settings/class-lp-settings-profile.php:178
3099
+ #: inc/admin/settings/class-lp-settings-profile.php:197
3100
+ #: inc/admin/settings/class-lp-settings-profile.php:205
3101
+ #: inc/admin/settings/class-lp-settings-profile.php:213
3102
+ #: inc/admin/settings/class-lp-settings-profile.php:221
3103
  #, php-format
3104
  msgid "Example link is %s"
3105
  msgstr ""
3106
 
3107
+ #: inc/admin/settings/class-lp-settings-profile.php:157
3108
+ #: inc/admin/settings/class-lp-settings-profile.php:291
3109
  #: inc/custom-post-types/quiz.php:90 inc/custom-post-types/quiz.php:91
3110
  #: inc/custom-post-types/quiz.php:95 inc/user/class-lp-profile.php:306
3111
  #: templates/widgets/course-info/default.php:34
3112
  msgid "Quizzes"
3113
  msgstr ""
3114
 
3115
+ #: inc/admin/settings/class-lp-settings-profile.php:165
3116
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:22
3117
  #: inc/admin/sub-menus/class-lp-submenu-statistics.php:29
3118
+ #: inc/custom-post-types/order.php:847 inc/custom-post-types/order.php:848
3119
+ #: inc/custom-post-types/order.php:852 inc/user/class-lp-profile.php:312
3120
  msgid "Orders"
3121
  msgstr ""
3122
 
3123
+ #: inc/admin/settings/class-lp-settings-profile.php:173
3124
  #: inc/admin/views/meta-boxes/order/details.php:37
3125
  #: inc/user/class-lp-profile.php:318
3126
  msgid "Order details"
3127
  msgstr ""
3128
 
3129
+ #: inc/admin/settings/class-lp-settings-profile.php:187
3130
  msgid "Settings Tab"
3131
  msgstr ""
3132
 
3133
+ #: inc/admin/settings/class-lp-settings-profile.php:189
3134
  msgid "The slugs of sections in settings tab. Each slugs should be unique."
3135
  msgstr ""
3136
 
3137
+ #: inc/admin/settings/class-lp-settings-profile.php:192
3138
  msgid "Slug"
3139
  msgstr ""
3140
 
3141
+ #: inc/admin/settings/class-lp-settings-profile.php:200
3142
  msgid "Basic Information"
3143
  msgstr ""
3144
 
3145
+ #: inc/admin/settings/class-lp-settings-profile.php:208
3146
+ #: inc/admin/settings/class-lp-settings-profile.php:229
3147
  #: inc/user/class-lp-profile.php:348
3148
  msgid "Avatar"
3149
  msgstr ""
3150
 
3151
+ #: inc/admin/settings/class-lp-settings-profile.php:216
3152
  msgid "Change Password"
3153
  msgstr ""
3154
 
3155
+ #: inc/admin/settings/class-lp-settings-profile.php:231
3156
  msgid "User avatar settings."
3157
  msgstr ""
3158
 
3159
+ #: inc/admin/settings/class-lp-settings-profile.php:234
3160
  msgid "Enable custom avatar"
3161
  msgstr ""
3162
 
3163
+ #: inc/admin/settings/class-lp-settings-profile.php:240
3164
  msgid "Size"
3165
  msgstr ""
3166
 
3167
+ #: inc/admin/settings/class-lp-settings-profile.php:254
3168
  msgid "The height and width of avatar should be equal."
3169
  msgstr ""
3170
 
3171
+ #: inc/admin/settings/class-lp-settings-profile.php:262
3172
  #: inc/user/class-lp-profile.php:357
3173
  msgid "Publicity"
3174
  msgstr ""
3175
 
3176
+ #: inc/admin/settings/class-lp-settings-profile.php:264
3177
  msgid "Publicity and sharing user profile content."
3178
  msgstr ""
3179
 
3180
+ #: inc/admin/settings/class-lp-settings-profile.php:267
3181
  #: templates/profile/tabs/settings/publicity.php:38
3182
  msgid "My dashboard"
3183
  msgstr ""
3184
 
3185
+ #: inc/admin/settings/class-lp-settings-profile.php:271
3186
  #: templates/profile/tabs/settings/publicity.php:43
3187
  msgid ""
3188
  "Public user profile content, if this option is turn off then other sections "
3189
  "in profile also become invisible."
3190
  msgstr ""
3191
 
3192
+ #: inc/admin/settings/class-lp-settings-profile.php:278
3193
  msgid "Public user profile courses."
3194
  msgstr ""
3195
 
3196
+ #: inc/admin/settings/class-lp-settings-profile.php:278
3197
  msgid "Allow user to turn on/off sharing profile course option"
3198
  msgstr ""
3199
 
3200
+ #: inc/admin/settings/class-lp-settings-profile.php:295
3201
  msgid "Public user profile quizzes."
3202
  msgstr ""
3203
 
3204
+ #: inc/admin/settings/class-lp-settings-profile.php:295
3205
  msgid "Allow user to turn on/off sharing profile quizzes option"
3206
  msgstr ""
3207
 
3377
  msgid "Other"
3378
  msgstr ""
3379
 
3380
+ #: inc/admin/views/course/editor.php:25
3381
  msgid "Something went wrong! Please reload to continue editing curriculum."
3382
  msgstr ""
3383
 
3384
+ #: inc/admin/views/course/modal-choose-items.php:57
3385
  #: inc/admin/views/quiz/modal-choose-items.php:52
3386
+ #: inc/custom-post-types/course.php:98 inc/custom-post-types/quiz.php:179
3387
  msgid "Selected items"
3388
  msgstr ""
3389
 
3390
+ #: inc/admin/views/course/modal-choose-items.php:77
 
3391
  msgid "Type here to search item"
3392
  msgstr ""
3393
 
3394
+ #: inc/admin/views/course/modal-choose-items.php:83
3395
+ #: inc/admin/views/quiz/modal-choose-items.php:70
3396
  msgid "No item found."
3397
  msgstr ""
3398
 
3399
+ #: inc/admin/views/course/modal-choose-items.php:101
3400
+ #: inc/admin/views/quiz/modal-choose-items.php:89
3401
  msgid "Adding"
3402
  msgstr ""
3403
 
3417
  msgid "Next"
3418
  msgstr ""
3419
 
3420
+ #: inc/admin/views/course/section-item.php:37
3421
  msgid "Remove from course"
3422
  msgstr ""
3423
 
3424
+ #: inc/admin/views/course/section-item.php:41
3425
+ #: inc/admin/views/quiz/question-actions.php:51
3426
+ msgid "Move to trash"
3427
  msgstr ""
3428
 
3429
+ #: inc/admin/views/course/section.php:21
3430
  msgid "Enter the name section"
3431
  msgstr ""
3432
 
3433
+ #: inc/admin/views/course/section.php:38
3434
  msgid "Describe about this section"
3435
  msgstr ""
3436
 
3437
+ #: inc/admin/views/course/section.php:56
3438
  msgid "Select items"
3439
  msgstr ""
3440
 
3441
+ #: inc/admin/views/course/section.php:61
3442
  msgid "Are you sure?"
3443
  msgstr ""
3444
 
3468
 
3469
  #: inc/admin/views/meta-boxes/course/assigned.php:27
3470
  #: inc/admin/views/meta-boxes/quiz/assigned.php:49
3471
+ #: inc/custom-post-types/abstract.php:595
3472
+ #: inc/custom-post-types/question.php:370
3473
  msgid "Not assigned yet"
3474
  msgstr ""
3475
 
3534
  msgstr ""
3535
 
3536
  #: inc/admin/views/meta-boxes/order/actions.php:19
3537
+ msgid "Choose an action"
 
 
 
3538
  msgstr ""
3539
 
3540
  #: inc/admin/views/meta-boxes/order/actions.php:20
3549
  msgid "Move to Trash"
3550
  msgstr ""
3551
 
3552
+ #: inc/admin/views/meta-boxes/order/child-order.php:21
3553
+ #: inc/admin/views/meta-boxes/order/details.php:83
3554
+ #: inc/admin/views/meta-boxes/order/details.php:196
3555
+ #: inc/admin/views/meta-boxes/order/details.php:205
3556
+ msgid "Customer"
3557
+ msgstr ""
3558
+
3559
+ #: inc/admin/views/meta-boxes/order/child-order.php:22
3560
+ #: inc/admin/views/meta-boxes/order/details.php:117
3561
+ #: templates/order/recover-form.php:22
3562
+ msgid "Order key"
3563
+ msgstr ""
3564
+
3565
  #: inc/admin/views/meta-boxes/order/details.php:26
3566
  #, php-format
3567
  msgid "Order %s"
3569
 
3570
  #: inc/admin/views/meta-boxes/order/details.php:39
3571
  #: inc/admin/views/statistics/orders.php:46
3572
+ #: inc/custom-post-types/order.php:717
3573
+ #: templates/checkout/order-received.php:62
3574
+ #: templates/profile/tabs/courses.php:33 templates/profile/tabs/quizzes.php:39
3575
  #: templates/profile/tabs/courses/purchased.php:39
3576
  #: templates/profile/tabs/orders/list.php:33
3577
  msgid "Date"
3581
  msgid "Customers"
3582
  msgstr ""
3583
 
3584
+ #: inc/admin/views/meta-boxes/order/details.php:80
3585
+ #: inc/admin/views/meta-boxes/order/details.php:101
3586
+ #: inc/admin/views/meta-boxes/order/details.php:211
3587
  msgid "Add multi users"
3588
  msgstr ""
3589
 
3590
+ #: inc/admin/views/meta-boxes/order/details.php:94
3591
+ #: inc/admin/views/meta-boxes/order/details.php:201
 
 
 
 
 
 
3592
  msgid "Change"
3593
  msgstr ""
3594
 
3595
+ #: inc/admin/views/meta-boxes/order/details.php:99
3596
  msgid "- Or -"
3597
  msgstr ""
3598
 
3599
+ #: inc/admin/views/meta-boxes/order/details.php:106
3600
  msgid ""
3601
  "In order to change the order user, please change the order status to "
3602
  "'Pending'."
3603
  msgstr ""
3604
 
3605
+ #: inc/admin/views/meta-boxes/order/details.php:121
 
 
 
 
 
3606
  msgid "Order Items"
3607
  msgstr ""
3608
 
3609
+ #: inc/admin/views/meta-boxes/order/details.php:126
3610
+ #: inc/custom-post-types/course.php:101
3611
  #: inc/gateways/paypal/class-lp-gateway-paypal.php:434
3612
+ #: templates/checkout/order-received.php:35
3613
  msgid "Item"
3614
  msgstr ""
3615
 
3616
+ #: inc/admin/views/meta-boxes/order/details.php:127
3617
  msgid "Cost"
3618
  msgstr ""
3619
 
3620
+ #: inc/admin/views/meta-boxes/order/details.php:128
3621
  #: templates/emails/order-items-table.php:58
3622
  msgid "Quantity"
3623
  msgstr ""
3624
 
3625
+ #: inc/admin/views/meta-boxes/order/details.php:129
3626
  msgid "Amount"
3627
  msgstr ""
3628
 
3629
+ #: inc/admin/views/meta-boxes/order/details.php:139
3630
  msgid "No order items"
3631
  msgstr ""
3632
 
3633
+ #: inc/admin/views/meta-boxes/order/details.php:145
3634
  msgid "Sub Total"
3635
  msgstr ""
3636
 
3637
+ #: inc/admin/views/meta-boxes/order/details.php:159
3638
+ #: inc/custom-post-types/order.php:718
3639
+ #: templates/checkout/order-received.php:68
3640
  #: templates/checkout/review-order.php:33
3641
  #: templates/checkout/review-order.php:162
3642
  #: templates/emails/order-items-table.php:87
3646
  msgid "Total"
3647
  msgstr ""
3648
 
3649
+ #: inc/admin/views/meta-boxes/order/details.php:175
3650
  msgid "Add Item"
3651
  msgstr ""
3652
 
3653
+ #: inc/admin/views/meta-boxes/order/details.php:178
3654
  msgid ""
3655
  "In order to change the order item, please change the order status to "
3656
  "'Pending'."
3657
  msgstr ""
3658
 
3659
+ #: inc/admin/views/meta-boxes/order/details.php:181
3660
  msgid "Calculate Total"
3661
  msgstr ""
3662
 
3663
+ #: inc/admin/views/meta-boxes/order/details.php:189
3664
  msgid "Customer Note"
3665
  msgstr ""
3666
 
3667
+ #: inc/admin/views/meta-boxes/order/details.php:237
3668
  msgid "Type here to search the course"
3669
  msgstr ""
3670
 
3671
+ #: inc/admin/views/meta-boxes/order/details.php:240
3672
  msgid "No results"
3673
  msgstr ""
3674
 
3675
+ #: inc/admin/views/question/actions.php:13
 
 
 
 
3676
  msgid "Question Answers"
3677
  msgstr ""
3678
 
3682
  msgstr ""
3683
 
3684
  #: inc/admin/views/question/answer.php:19
3685
+ #: inc/admin/views/quiz/question-answer.php:20
3686
+ msgid "Correct?"
3687
  msgstr ""
3688
 
3689
  #: inc/admin/views/question/answer.php:35
3693
 
3694
  #: inc/admin/views/quiz/editor.php:16
3695
  #: inc/admin/views/quiz/modal-choose-items.php:55
3696
+ #: inc/custom-post-types/question.php:178 inc/custom-post-types/quiz.php:184
3697
+ #: inc/custom-post-types/quiz.php:347 templates/content-quiz/intro.php:36
3698
  msgid "Questions"
3699
  msgstr ""
3700
 
3701
+ #: inc/admin/views/quiz/editor.php:30 inc/admin/views/settings/payments.php:24
3702
+ #: inc/custom-post-types/question.php:329
3703
  msgid "Type"
3704
  msgstr ""
3705
 
3706
+ #: inc/admin/views/quiz/editor.php:31
3707
+ #: inc/admin/views/tools/course/html-course.php:31
3708
+ #: inc/admin/views/tools/course/html-user.php:31
3709
+ msgid "Actions"
3710
+ msgstr ""
3711
+
3712
+ #: inc/admin/views/quiz/editor.php:47
3713
+ msgid "Create a new question"
3714
  msgstr ""
3715
 
3716
+ #: inc/admin/views/quiz/editor.php:54
3717
+ msgid "Add as New..."
3718
  msgstr ""
3719
 
3720
+ #: inc/admin/views/quiz/editor.php:64
3721
+ #: inc/libraries/meta-box/inc/fields/file-input.php:39
3722
  #: inc/libraries/meta-box/inc/fields/select.php:87
3723
  msgid "Select"
3724
  msgstr ""
3725
 
3726
+ #: inc/admin/views/quiz/editor.php:78
3727
  msgid "Something went wrong! Please reload to continue editing quiz questions."
3728
  msgstr ""
3729
 
3730
+ #: inc/admin/views/quiz/modal-choose-items.php:65
3731
+ msgid "Type here to search question"
3732
  msgstr ""
3733
 
3734
+ #: inc/admin/views/quiz/question-actions.php:47
3735
+ msgid "Remove from quiz"
3736
  msgstr ""
3737
 
3738
+ #: inc/admin/views/quiz/question-meta.php:19
3739
  #: inc/question/class-lp-question.php:412
3740
  msgid "Question Content"
3741
  msgstr ""
3742
 
3743
+ #: inc/admin/views/quiz/question-meta.php:31
3744
+ #: inc/custom-post-types/question.php:289
3745
  msgid "Mark for this question"
3746
  msgstr ""
3747
 
3748
+ #: inc/admin/views/quiz/question-meta.php:37
3749
+ #: inc/custom-post-types/question.php:293
3750
  msgid "Mark for choosing the right answer."
3751
  msgstr ""
3752
 
3753
+ #: inc/admin/views/quiz/question-meta.php:43
3754
+ #: inc/custom-post-types/question.php:298
3755
  msgid "Question Explanation"
3756
  msgstr ""
3757
 
3758
+ #: inc/admin/views/quiz/question-meta.php:51
3759
+ #: inc/custom-post-types/question.php:301
3760
  msgid ""
3761
  "Explain why an option is true and other is false. The text will be shown "
3762
  "when user click on 'Check answer' button."
3763
  msgstr ""
3764
 
3765
+ #: inc/admin/views/quiz/question-meta.php:57
3766
+ #: inc/custom-post-types/question.php:305
3767
  msgid "Question Hint"
3768
  msgstr ""
3769
 
3770
+ #: inc/admin/views/quiz/question-meta.php:64
3771
+ #: inc/custom-post-types/question.php:308
3772
  msgid ""
3773
  "Instruction for user to select the right answer. The text will be shown when "
3774
  "users click the 'Hint' button."
3784
  #: inc/emails/class-lp-email-updated-course.php:164
3785
  #: inc/emails/class-lp-email-user-order-changed-status.php:136
3786
  #: inc/emails/class-lp-email-user-order-completed.php:137
3787
+ #: inc/emails/class-lp-email.php:996
 
 
 
3788
  #: inc/gateways/paypal/class-lp-gateway-paypal.php:498
3789
  msgid "Enable"
3790
  msgstr ""
3857
  #: inc/emails/class-lp-email-updated-course.php:170
3858
  #: inc/emails/class-lp-email-user-order-changed-status.php:142
3859
  #: inc/emails/class-lp-email-user-order-completed.php:143
3860
+ #: inc/emails/class-lp-email.php:1019
 
 
 
3861
  msgid "Subject"
3862
  msgstr ""
3863
 
3877
  #: inc/emails/class-lp-email-updated-course.php:204
3878
  #: inc/emails/class-lp-email-user-order-changed-status.php:176
3879
  #: inc/emails/class-lp-email-user-order-completed.php:177
3880
+ #: inc/emails/class-lp-email.php:1053
 
 
 
3881
  msgid "Email content"
3882
  msgstr ""
3883
 
3964
 
3965
  #: inc/admin/views/setup/content.php:75
3966
  #: inc/admin/views/updates/update-screen.php:46
3967
+ #: inc/custom-post-types/course.php:97 inc/custom-post-types/quiz.php:178
3968
  #: templates/checkout/form.php:89 templates/checkout/payment.php:132
3969
  msgid "Back"
3970
  msgstr ""
4275
  msgstr ""
4276
 
4277
  #: inc/admin/views/tools/course/html-course.php:12
4278
+ msgid "Reset course progress"
4279
  msgstr ""
4280
 
4281
  #: inc/admin/views/tools/course/html-course.php:14
4282
+ msgid ""
4283
+ "This action will reset progress of a course for all users have enrolled."
4284
  msgstr ""
4285
 
4286
+ #: inc/admin/views/tools/course/html-course.php:15
4287
+ msgid "Search results only show course have user data."
 
4288
  msgstr ""
4289
 
4290
+ #: inc/admin/views/tools/course/html-course.php:19
4291
+ msgid "Search course by name"
 
4292
  msgstr ""
4293
 
4294
+ #: inc/admin/views/tools/course/html-course.php:21
4295
+ #: inc/admin/views/tools/course/html-user.php:21 templates/search-form.php:29
4296
+ msgid "Search"
4297
  msgstr ""
4298
 
4299
+ #: inc/admin/views/tools/course/html-course.php:52
4300
  msgid "Please enter at least 3 characters to searching courses."
4301
  msgstr ""
4302
 
4303
+ #: inc/admin/views/tools/course/html-course.php:54
4304
  msgid "Searching course..."
4305
  msgstr ""
4306
 
4307
+ #: inc/admin/views/tools/course/html-course.php:62
4308
+ #: inc/admin/views/tools/course/html-user.php:70
4309
+ msgid ""
4310
+ "Are you sure to reset course progress of all users enrolled this course?"
4311
  msgstr ""
4312
 
4313
  #: inc/admin/views/tools/course/html-user-item.php:12
4314
+ msgid "Reset item progress for an user"
4315
  msgstr ""
4316
 
4317
  #: inc/admin/views/tools/course/html-user-item.php:14
4318
+ msgid "This action will reset progress of specific lesson or quiz."
 
4319
  msgstr ""
4320
 
4321
  #: inc/admin/views/tools/course/html-user-item.php:18
4326
  msgid "Item ID (ID of quiz or lesson)"
4327
  msgstr ""
4328
 
4329
+ #: inc/admin/views/tools/course/html-user-item.php:35
4330
+ msgid "Are you sure to reset progress of this item?"
4331
+ msgstr ""
4332
+
4333
  #: inc/admin/views/tools/course/html-user.php:12
4334
+ msgid "Reset user progress"
4335
+ msgstr ""
4336
+
4337
+ #: inc/admin/views/tools/course/html-user.php:14
4338
+ msgid ""
4339
+ "This action will reset progress of all courses that an user has enrolled."
4340
+ msgstr ""
4341
+
4342
+ #: inc/admin/views/tools/course/html-user.php:15
4343
+ msgid "Search results only show users have course data."
4344
  msgstr ""
4345
 
4346
+ #: inc/admin/views/tools/course/html-user.php:19
4347
+ msgid "Search user by login name or email"
4348
  msgstr ""
4349
 
4350
+ #: inc/admin/views/tools/course/html-user.php:60
4351
  msgid "Please enter at least 3 characters to searching users."
4352
  msgstr ""
4353
 
4354
+ #: inc/admin/views/tools/course/html-user.php:61
4355
  msgid "No user found."
4356
  msgstr ""
4357
 
4358
+ #: inc/admin/views/tools/course/html-user.php:62
4359
  msgid "Searching user..."
4360
  msgstr ""
4361
 
4434
 
4435
  #: inc/admin/views/tools/database/html-remove-database.php:23
4436
  #: inc/admin/views/tools/database/html-remove-outdated-data.php:23
4437
+ #: inc/libraries/meta-box/inc/fields/file-input.php:41
4438
  #: templates/profile/tabs/settings/avatar.php:60
4439
  msgid "Remove"
4440
  msgstr ""
4471
  "latest version."
4472
  msgstr ""
4473
 
4474
+ #: inc/admin/views/updates/html-updated-latest-message.php:16
4475
+ msgid "LearnPress has just updated to latest version."
4476
+ msgstr ""
4477
+
4478
+ #: inc/admin/views/updates/html-updating-message.php:14
4479
+ msgid ""
4480
+ "<strong>LearnPress update</strong> – We are running updater to upgrade your "
4481
+ "database to the latest version."
4482
+ msgstr ""
4483
+
4484
  #: inc/admin/views/updates/html-upgrade-message-3.0.0.php:14
4485
  #, php-format
4486
  msgid "Welcome to LearnPress %s"
4684
  msgid "No &quot;Course %s&quot; found"
4685
  msgstr ""
4686
 
4687
+ #: inc/background-process/class-lp-background-query-items.php:84
4688
  msgid "WP query plugins error!"
4689
  msgstr ""
4690
 
4691
+ #: inc/background-process/class-lp-background-query-items.php:87
4692
  msgid "WP query plugins empty!"
4693
  msgstr ""
4694
 
4710
  "%s has been removed from your cart because it can no longer be purchased."
4711
  msgstr ""
4712
 
4713
+ #: inc/course/abstract-course.php:532
4714
  msgid "You enrolled"
4715
  msgstr ""
4716
 
4717
+ #: inc/course/abstract-course.php:536
4718
  #, php-format
4719
  msgctxt "students-html"
4720
  msgid "You and one student enrolled"
4723
  msgstr[0] ""
4724
  msgstr[1] ""
4725
 
4726
+ #: inc/course/abstract-course.php:546
4727
  #, php-format
4728
  msgctxt "students-html"
4729
  msgid "One student enrolled"
4732
  msgstr[0] ""
4733
  msgstr[1] ""
4734
 
4735
+ #: inc/course/abstract-course.php:549
4736
  msgid "No student enrolled"
4737
  msgstr ""
4738
 
4739
+ #: inc/course/abstract-course.php:806 inc/course/abstract-course.php:825
4740
+ #: inc/lesson/class-lp-lesson.php:104 inc/quiz/class-lp-quiz.php:518
4741
  #, php-format
4742
  msgid "The function %s doesn't exist"
4743
  msgstr ""
4744
 
4745
+ #: inc/course/abstract-course.php:1186
4746
  #, php-format
4747
  msgid "%d of %d items completed"
4748
  msgstr ""
4749
 
4750
+ #: inc/course/abstract-course.php:1189 inc/course/abstract-course.php:1191
4751
  #, php-format
4752
  msgid "%d%% completed"
4753
  msgstr ""
4754
 
4755
+ #: inc/course/abstract-course.php:1659
4756
  #, php-format
4757
  msgid "This course will end within next %s"
4758
  msgstr ""
4759
 
4760
+ #: inc/course/abstract-course.php:1766
4761
  msgctxt "Text of Buy this course with external link"
4762
  msgid "Buy this course"
4763
  msgstr ""
4764
 
4765
+ #: inc/course/abstract-course.php:1816
4766
  msgid "Tags: "
4767
  msgstr ""
4768
 
4776
  msgid "The course %d does not exists"
4777
  msgstr ""
4778
 
4779
+ #: inc/course/lp-course-functions.php:839
4780
  msgid "Permalink only available if the item is already assigned to a course."
4781
  msgstr ""
4782
 
4783
+ #: inc/course/lp-course-functions.php:1054
4784
  #, php-format
4785
  msgid "Welcome back, %s"
4786
  msgstr ""
4835
  msgstr ""
4836
 
4837
  #: inc/curds/class-lp-order-curd.php:485
4838
+ #: templates/checkout/order-received.php:88
4839
  msgid "Invalid order."
4840
  msgstr ""
4841
 
4889
  msgid "<p>Sorry! Failed to duplicate quiz!</p>"
4890
  msgstr ""
4891
 
4892
+ #: inc/curds/class-lp-user-curd.php:1086 inc/curds/class-lp-user-curd.php:1279
4893
  msgid "course"
4894
  msgstr ""
4895
 
4896
+ #: inc/curds/class-lp-user-curd.php:1087 inc/curds/class-lp-user-curd.php:1280
4897
  msgid "courses"
4898
  msgstr ""
4899
 
4900
+ #: inc/curds/class-lp-user-curd.php:1478
4901
  msgid "quiz"
4902
  msgstr ""
4903
 
4904
+ #: inc/curds/class-lp-user-curd.php:1479
4905
  msgid "quizzes"
4906
  msgstr ""
4907
 
4908
+ #: inc/curds/class-lp-user-curd.php:1536
4909
  msgid "Please provide a valid email address."
4910
  msgstr ""
4911
 
4912
+ #: inc/curds/class-lp-user-curd.php:1540
4913
  msgid ""
4914
  "An account is already registered with your email address. Please log in."
4915
  msgstr ""
4916
 
4917
+ #: inc/curds/class-lp-user-curd.php:1546
4918
  msgid "Please enter a valid account username."
4919
  msgstr ""
4920
 
4921
+ #: inc/curds/class-lp-user-curd.php:1550
4922
  msgid ""
4923
  "An account is already registered with that username. Please choose another."
4924
  msgstr ""
4925
 
4926
+ #: inc/curds/class-lp-user-curd.php:1562
4927
  msgid "Failed to create user"
4928
  msgstr ""
4929
 
4935
  msgid "Invalid quiz."
4936
  msgstr ""
4937
 
4938
+ #: inc/custom-post-types/abstract.php:144
4939
+ #: inc/custom-post-types/abstract.php:160
4940
+ msgid "Search by user"
4941
+ msgstr ""
4942
+
4943
+ #: inc/custom-post-types/abstract.php:211
4944
+ msgid ""
4945
+ "This item has already assigned to course. It will be removed from course if "
4946
+ "it is not published."
4947
+ msgstr ""
4948
+
4949
+ #: inc/custom-post-types/abstract.php:222
4950
+ msgid ""
4951
+ "This question has already assigned to quiz. It will be removed from quiz if "
4952
+ "it is not published."
4953
+ msgstr ""
4954
+
4955
+ #: inc/custom-post-types/abstract.php:562
4956
+ #, php-format
4957
+ msgid "Course (%d %s)"
4958
+ msgid_plural "Course (%d %s)"
4959
+ msgstr[0] ""
4960
+ msgstr[1] ""
4961
+
4962
+ #: inc/custom-post-types/abstract.php:589
4963
+ msgid "Remove Filter"
4964
+ msgstr ""
4965
+
4966
+ #: inc/custom-post-types/abstract.php:736
4967
+ #: inc/custom-post-types/abstract.php:739
4968
  msgid "updated."
4969
  msgstr ""
4970
 
4971
+ #: inc/custom-post-types/abstract.php:737
4972
  msgid "Custom field updated."
4973
  msgstr ""
4974
 
4975
+ #: inc/custom-post-types/abstract.php:738
4976
  msgid "Custom field deleted."
4977
  msgstr ""
4978
 
4979
+ #: inc/custom-post-types/abstract.php:741
4980
  #, php-format
4981
  msgid "Lesson restored to revision from %s"
4982
  msgstr ""
4983
 
4984
+ #: inc/custom-post-types/abstract.php:742
4985
  msgid "published."
4986
  msgstr ""
4987
 
4988
+ #: inc/custom-post-types/abstract.php:743
4989
  msgid "saved."
4990
  msgstr ""
4991
 
4992
+ #: inc/custom-post-types/abstract.php:744
4993
  msgid "submitted."
4994
  msgstr ""
4995
 
4996
+ #: inc/custom-post-types/abstract.php:746
4997
  #, php-format
4998
  msgid "scheduled for: <strong>%1$s</strong>."
4999
  msgstr ""
5000
 
5001
+ #: inc/custom-post-types/abstract.php:748
5002
  msgid "M j, Y @ G:i"
5003
  msgstr ""
5004
 
5005
+ #: inc/custom-post-types/abstract.php:750
5006
  msgid "draft updated."
5007
  msgstr ""
5008
 
5009
+ #: inc/custom-post-types/course.php:96
5010
+ msgid "Create a new"
5011
+ msgstr ""
5012
+
5013
+ #: inc/custom-post-types/course.php:99
5014
+ msgid "Do you want to remove item \"{{ITEM_NAME}}\" to trash?"
5015
+ msgstr ""
5016
+
5017
+ #: inc/custom-post-types/course.php:102
5018
+ msgid "Items"
5019
+ msgstr ""
5020
+
5021
+ #: inc/custom-post-types/course.php:121
5022
  msgctxt "Post Type General Name"
5023
  msgid "Courses"
5024
  msgstr ""
5025
 
5026
+ #: inc/custom-post-types/course.php:122
5027
  msgctxt "Post Type Singular Name"
5028
  msgid "Course"
5029
  msgstr ""
5030
 
5031
+ #: inc/custom-post-types/course.php:124
5032
  msgid "Parent Item:"
5033
  msgstr ""
5034
 
5035
+ #: inc/custom-post-types/course.php:126
5036
  msgid "View Course"
5037
  msgstr ""
5038
 
5039
+ #: inc/custom-post-types/course.php:127
5040
  msgid "Add New Course"
5041
  msgstr ""
5042
 
5043
+ #: inc/custom-post-types/course.php:128 inc/custom-post-types/lesson.php:208
5044
+ #: inc/custom-post-types/order.php:854 inc/custom-post-types/question.php:181
5045
  msgid "Add New"
5046
  msgstr ""
5047
 
5048
+ #: inc/custom-post-types/course.php:129
5049
  msgid "Edit Course"
5050
  msgstr ""
5051
 
5052
+ #: inc/custom-post-types/course.php:130
5053
  msgid "Update Course"
5054
  msgstr ""
5055
 
5056
+ #: inc/custom-post-types/course.php:131
5057
  msgid "Search Courses"
5058
  msgstr ""
5059
 
5060
+ #: inc/custom-post-types/course.php:132
5061
  #, php-format
5062
  msgid ""
5063
  "You haven't had any courses yet. Click <a href=\"%s\">Add new</a> to start"
5064
  msgstr ""
5065
 
5066
+ #: inc/custom-post-types/course.php:133
5067
  msgid "No course found in Trash"
5068
  msgstr ""
5069
 
5070
+ #: inc/custom-post-types/course.php:173 inc/custom-post-types/course.php:175
5071
  msgid "Course Categories"
5072
  msgstr ""
5073
 
5074
+ #: inc/custom-post-types/course.php:176 inc/custom-post-types/course.php:177
5075
  msgid "Category"
5076
  msgstr ""
5077
 
5078
+ #: inc/custom-post-types/course.php:178
5079
  msgid "Add New Course Category"
5080
  msgstr ""
5081
 
5082
+ #: inc/custom-post-types/course.php:179
5083
  msgid "All Categories"
5084
  msgstr ""
5085
 
5086
+ #: inc/custom-post-types/course.php:190
5087
  msgctxt "slug"
5088
  msgid "course-category"
5089
  msgstr ""
5090
 
5091
+ #: inc/custom-post-types/course.php:201
5092
  msgid "Course Tags"
5093
  msgstr ""
5094
 
5095
+ #: inc/custom-post-types/course.php:202 inc/custom-post-types/question.php:154
5096
+ #: inc/custom-post-types/question.php:155
5097
  #: inc/updates/_update-from-0.9.php:1194 inc/updates/_update-from-0.9.php:1195
5098
  #: inc/updates/_update-from-0.9.php:1196 inc/updates/_update-from-0.9.php:1217
5099
  #: inc/updates/_update-from-0.9.php:1218
5100
  msgid "Tag"
5101
  msgstr ""
5102
 
5103
+ #: inc/custom-post-types/course.php:203
5104
  msgid "Search Course Tags"
5105
  msgstr ""
5106
 
5107
+ #: inc/custom-post-types/course.php:204
5108
  msgid "Popular Course Tags"
5109
  msgstr ""
5110
 
5111
+ #: inc/custom-post-types/course.php:205
5112
  msgid "All Course Tags"
5113
  msgstr ""
5114
 
5115
+ #: inc/custom-post-types/course.php:208
5116
  msgid "Edit Course Tag"
5117
  msgstr ""
5118
 
5119
+ #: inc/custom-post-types/course.php:209
5120
  msgid "Update Course Tag"
5121
  msgstr ""
5122
 
5123
+ #: inc/custom-post-types/course.php:210
5124
  msgid "Add New Course Tag"
5125
  msgstr ""
5126
 
5127
+ #: inc/custom-post-types/course.php:211
5128
  msgid "New Course Tag Name"
5129
  msgstr ""
5130
 
5131
+ #: inc/custom-post-types/course.php:212
5132
  msgid "Separate tags with commas"
5133
  msgstr ""
5134
 
5135
+ #: inc/custom-post-types/course.php:213
5136
  msgid "Add or remove tags"
5137
  msgstr ""
5138
 
5139
+ #: inc/custom-post-types/course.php:214
5140
  msgid "Choose from the most used tags"
5141
  msgstr ""
5142
 
5143
+ #: inc/custom-post-types/course.php:224
5144
  msgctxt "slug"
5145
  msgid "course-tag"
5146
  msgstr ""
5147
 
5148
+ #: inc/custom-post-types/course.php:363
 
 
 
 
5149
  msgid "Sorry! You can not update a course while it is being viewed!"
5150
  msgstr ""
5151
 
5152
+ #: inc/custom-post-types/course.php:554
5153
  msgid "Course Settings"
5154
  msgstr ""
5155
 
5156
+ #: inc/custom-post-types/course.php:576 inc/custom-post-types/lesson.php:336
5157
+ #: inc/custom-post-types/quiz.php:263 inc/custom-post-types/quiz.php:348
5158
  #: templates/content-quiz/intro.php:28
5159
  msgid "Duration"
5160
  msgstr ""
5161
 
5162
+ #: inc/custom-post-types/course.php:579
5163
  msgid "The duration of the course."
5164
  msgstr ""
5165
 
5166
+ #: inc/custom-post-types/course.php:583
5167
  msgid "Maximum Students"
5168
  msgstr ""
5169
 
5170
+ #: inc/custom-post-types/course.php:586
5171
  msgid "Maximum number of students who can enroll in this course."
5172
  msgstr ""
5173
 
5174
+ #: inc/custom-post-types/course.php:590
5175
  msgid "Students Enrolled"
5176
  msgstr ""
5177
 
5178
+ #: inc/custom-post-types/course.php:593
5179
  msgid "How many students have taken this course."
5180
  msgstr ""
5181
 
5182
+ #: inc/custom-post-types/course.php:604
5183
  msgid "Re-take Course"
5184
  msgstr ""
5185
 
5186
+ #: inc/custom-post-types/course.php:608
5187
  msgid ""
5188
  "How many times the user can re-take this course. Set to 0 to disable re-"
5189
  "taking"
5190
  msgstr ""
5191
 
5192
+ #: inc/custom-post-types/course.php:612
5193
  msgid "Featured"
5194
  msgstr ""
5195
 
5196
+ #: inc/custom-post-types/course.php:615
5197
  msgid "Set course as featured."
5198
  msgstr ""
5199
 
5200
+ #: inc/custom-post-types/course.php:619
5201
+ msgid "Block Lessons"
5202
  msgstr ""
5203
 
5204
+ #: inc/custom-post-types/course.php:622
5205
  msgid "Block lessons content when completed course."
5206
  msgstr ""
5207
 
5208
+ #: inc/custom-post-types/course.php:626
5209
+ msgid "External Link"
5210
  msgstr ""
5211
 
5212
+ #: inc/custom-post-types/course.php:629
5213
  msgid "Redirect to this url when you press button buy this course."
5214
  msgstr ""
5215
 
5216
+ #: inc/custom-post-types/course.php:657
5217
  msgid "The method to assess the result of a student for a course."
5218
  msgstr ""
5219
 
5220
+ #: inc/custom-post-types/course.php:660
5221
  msgid ""
5222
  "<br /><strong>Note! </strong>No final quiz in course, please add a final quiz"
5223
  msgstr ""
5224
 
5225
+ #: inc/custom-post-types/course.php:677
5226
  msgid ""
5227
  "This is conditional \"passing grade\" of Final quiz will apply for result of "
5228
  "this course. When you change it here, the \"passing grade\" also change with "
5229
  "new value for the Final quiz."
5230
  msgstr ""
5231
 
5232
+ #: inc/custom-post-types/course.php:683
5233
  msgid ""
5234
  "<p>Evaluate by number of lessons completed per number of total lessons.</p>"
5235
  msgstr ""
5236
 
5237
+ #: inc/custom-post-types/course.php:684
5238
  msgid ""
5239
  "E.g: Course has 10 lessons and user completed 5 lessons then the result = "
5240
  "5/10 = 50.%"
5241
  msgstr ""
5242
 
5243
+ #: inc/custom-post-types/course.php:685
5244
  msgid ""
5245
  "Evaluate by results of final quiz in course. You have to add a quiz into end "
5246
  "of course."
5247
  msgstr ""
5248
 
5249
+ #: inc/custom-post-types/course.php:686
5250
  msgid ""
5251
  "Evaluate by achieved points of completed quizzes per total point of all "
5252
  "quizzes."
5253
  msgstr ""
5254
 
5255
+ #: inc/custom-post-types/course.php:687
5256
  msgid ""
5257
  "Evaluate by achieved points of quizzes passed per total point of all quizzes."
5258
  msgstr ""
5259
 
5260
+ #: inc/custom-post-types/course.php:688
5261
  msgid ""
5262
  "<p>Evaluate by number of quizzes completed per number of total quizzes.</p>"
5263
  msgstr ""
5264
 
5265
+ #: inc/custom-post-types/course.php:689
5266
  msgid ""
5267
  "<p>E.g: Course has 10 quizzes and user completed 5 quizzes then the result = "
5268
  "5/10 = 50%.</p>"
5269
  msgstr ""
5270
 
5271
+ #: inc/custom-post-types/course.php:696
5272
  msgid "Assessment"
5273
  msgstr ""
5274
 
5275
+ #: inc/custom-post-types/course.php:702
5276
  msgid "Course result"
5277
  msgstr ""
5278
 
5279
+ #: inc/custom-post-types/course.php:707
5280
  msgid "Evaluate via lessons"
5281
  msgstr ""
5282
 
5283
+ #: inc/custom-post-types/course.php:709
5284
  msgid "Evaluate via results of the final quiz"
5285
  msgstr ""
5286
 
5287
+ #: inc/custom-post-types/course.php:712
5288
  msgid "Evaluate via results of quizzes"
5289
  msgstr ""
5290
 
5291
+ #: inc/custom-post-types/course.php:714
5292
  msgid "Evaluate via results of quizzes passed"
5293
  msgstr ""
5294
 
5295
+ #: inc/custom-post-types/course.php:716
5296
  msgid "Evaluate via quizzes"
5297
  msgstr ""
5298
 
5299
+ #: inc/custom-post-types/course.php:723
5300
  msgid "Passing condition value"
5301
  msgstr ""
5302
 
5303
+ #: inc/custom-post-types/course.php:728
5304
  msgid ""
5305
  "The percentage of quiz result or completed lessons to finish the course."
5306
  msgstr ""
5307
 
5308
+ #: inc/custom-post-types/course.php:791
5309
  #, php-format
5310
  msgid ""
5311
  "This course requires enrollment and the suggested price is <strong>%s</"
5312
  "strong>"
5313
  msgstr ""
5314
 
5315
+ #: inc/custom-post-types/course.php:799
5316
  msgid "This course is free."
5317
  msgstr ""
5318
 
5319
+ #: inc/custom-post-types/course.php:806
5320
  #, php-format
5321
  msgid "Course price in <strong>%s</strong> currency."
5322
  msgstr ""
5323
 
5324
+ #: inc/custom-post-types/course.php:820 inc/custom-post-types/course.php:1281
5325
+ #: inc/custom-post-types/course.php:1288
5326
  #: templates/emails/order-items-table.php:59
5327
  msgid "Price"
5328
  msgstr ""
5329
 
5330
+ #: inc/custom-post-types/course.php:830
5331
  msgid "Sale Price"
5332
  msgstr ""
5333
 
5334
+ #: inc/custom-post-types/course.php:837
5335
  #, php-format
5336
  msgid "Course sale price in <strong>%s</strong> currency."
5337
  msgstr ""
5338
 
5339
+ #: inc/custom-post-types/course.php:838
5340
  msgid "Leave blank to remove sale price."
5341
  msgstr ""
5342
 
5343
+ #: inc/custom-post-types/course.php:840
5344
  msgid "Schedule"
5345
  msgstr ""
5346
 
5347
+ #: inc/custom-post-types/course.php:845
5348
  msgid "Sale start date"
5349
  msgstr ""
5350
 
5351
+ #: inc/custom-post-types/course.php:853
5352
  msgid "Sale end date"
5353
  msgstr ""
5354
 
5355
+ #: inc/custom-post-types/course.php:865
5356
  msgid "Price set by Admin"
5357
  msgstr ""
5358
 
5359
+ #: inc/custom-post-types/course.php:869
5360
  msgid "Not set"
5361
  msgstr ""
5362
 
5363
+ #: inc/custom-post-types/course.php:872
5364
  msgid "Course Suggestion Price"
5365
  msgstr ""
5366
 
5367
+ #: inc/custom-post-types/course.php:877
5368
  msgid "The course price you want to suggest for admin to set."
5369
  msgstr ""
5370
 
5371
+ #: inc/custom-post-types/course.php:888 inc/custom-post-types/course.php:1371
5372
+ msgid "No requirement enroll"
5373
  msgstr ""
5374
 
5375
+ #: inc/custom-post-types/course.php:891
5376
  msgid "Require users logged in to study or public to all."
5377
  msgstr ""
5378
 
5379
+ #: inc/custom-post-types/course.php:931 inc/custom-post-types/course.php:937
5380
+ #: inc/custom-post-types/course.php:1278 inc/custom-post-types/course.php:1285
5381
+ #: inc/custom-post-types/lesson.php:330 inc/custom-post-types/question.php:327
5382
+ #: inc/custom-post-types/quiz.php:345
5383
  msgid "Author"
5384
  msgstr ""
5385
 
5386
+ #: inc/custom-post-types/course.php:959
5387
  msgid "Review Logs"
5388
  msgstr ""
5389
 
5390
+ #: inc/custom-post-types/course.php:1008
5391
  msgid "Course Video"
5392
  msgstr ""
5393
 
5394
+ #: inc/custom-post-types/course.php:1013
5395
  msgid "Video ID"
5396
  msgstr ""
5397
 
5398
+ #: inc/custom-post-types/course.php:1016
5399
  msgid "The ID of Youtube or Vimeo video"
5400
  msgstr ""
5401
 
5402
+ #: inc/custom-post-types/course.php:1020
5403
  msgid "Video Type"
5404
  msgstr ""
5405
 
5406
+ #: inc/custom-post-types/course.php:1023
5407
  msgid "Chose video type"
5408
  msgstr ""
5409
 
5410
+ #: inc/custom-post-types/course.php:1026
5411
  msgid "Youtube"
5412
  msgstr ""
5413
 
5414
+ #: inc/custom-post-types/course.php:1027
5415
  msgid "Vimeo"
5416
  msgstr ""
5417
 
5418
+ #: inc/custom-post-types/course.php:1031
5419
  msgid "Embed width"
5420
  msgstr ""
5421
 
5422
+ #: inc/custom-post-types/course.php:1034
5423
  msgid "Set width of embed"
5424
  msgstr ""
5425
 
5426
+ #: inc/custom-post-types/course.php:1038
5427
  msgid "Embed height"
5428
  msgstr ""
5429
 
5430
+ #: inc/custom-post-types/course.php:1041
5431
  msgid "Set height of embed"
5432
  msgstr ""
5433
 
5434
+ #: inc/custom-post-types/course.php:1163
5435
  msgid "Course has been approved by Reviewer"
5436
  msgstr ""
5437
 
5438
+ #: inc/custom-post-types/course.php:1168
5439
  msgid "Course has been rejected by Reviewer"
5440
  msgstr ""
5441
 
5442
+ #: inc/custom-post-types/course.php:1173
5443
  #, php-format
5444
  msgid "Course has been submitted by %s"
5445
  msgstr ""
5446
 
5447
+ #: inc/custom-post-types/course.php:1178
5448
  msgid "Course has been updated by Reviewer"
5449
  msgstr ""
5450
 
5451
+ #: inc/custom-post-types/course.php:1279 inc/custom-post-types/course.php:1286
5452
  msgid "Content"
5453
  msgstr ""
5454
 
5455
+ #: inc/custom-post-types/course.php:1340
5456
  #, php-format
5457
  msgid "%d section"
5458
  msgid_plural "%d sections"
5459
  msgstr[0] ""
5460
  msgstr[1] ""
5461
 
5462
+ #: inc/custom-post-types/course.php:1340
5463
  msgid "0 section"
5464
  msgstr ""
5465
 
5466
+ #: inc/custom-post-types/course.php:1342
5467
  #: templates/widgets/featured-courses/default.php:86
5468
  #: templates/widgets/popular-courses/default.php:81
5469
  #: templates/widgets/recent-courses/default.php:86
5473
  msgstr[0] ""
5474
  msgstr[1] ""
5475
 
5476
+ #: inc/custom-post-types/course.php:1342
5477
  msgid "0 lesson"
5478
  msgstr ""
5479
 
5480
+ #: inc/custom-post-types/course.php:1344
5481
  #, php-format
5482
  msgid "%d quiz"
5483
  msgid_plural "%d quizzes"
5484
  msgstr[0] ""
5485
  msgstr[1] ""
5486
 
5487
+ #: inc/custom-post-types/course.php:1344
5488
  msgid "0 quiz"
5489
  msgstr ""
5490
 
5491
+ #: inc/custom-post-types/course.php:1351
5492
  msgid "No content"
5493
  msgstr ""
5494
 
5495
+ #: inc/custom-post-types/lesson.php:118 inc/custom-post-types/question.php:64
 
 
 
 
5496
  #: inc/custom-post-types/quiz.php:64
5497
  #, php-format
5498
  msgid "Unassigned %s"
5499
  msgstr ""
5500
 
5501
+ #: inc/custom-post-types/lesson.php:134
5502
  #, php-format
5503
  msgid "Preview %s"
5504
  msgstr ""
5505
 
5506
+ #: inc/custom-post-types/lesson.php:151
5507
  #, php-format
5508
  msgid "No Preview %s"
5509
  msgstr ""
5510
 
5511
+ #: inc/custom-post-types/lesson.php:202 inc/custom-post-types/lesson.php:203
5512
+ #: inc/custom-post-types/lesson.php:206
5513
  #: templates/widgets/course-info/default.php:29
5514
  msgid "Lessons"
5515
  msgstr ""
5516
 
5517
+ #: inc/custom-post-types/lesson.php:205
5518
  msgid "Add New Lesson"
5519
  msgstr ""
5520
 
5521
+ #: inc/custom-post-types/lesson.php:207
5522
  msgid "View Lesson"
5523
  msgstr ""
5524
 
5525
+ #: inc/custom-post-types/lesson.php:209
5526
  msgid "Edit Lesson"
5527
  msgstr ""
5528
 
5529
+ #: inc/custom-post-types/lesson.php:210
5530
  msgid "Update Lesson"
5531
  msgstr ""
5532
 
5533
+ #: inc/custom-post-types/lesson.php:211
5534
  msgid "Search Lessons"
5535
  msgstr ""
5536
 
5537
+ #: inc/custom-post-types/lesson.php:212
5538
  msgid "No lesson found"
5539
  msgstr ""
5540
 
5541
+ #: inc/custom-post-types/lesson.php:213
5542
  msgid "No lesson found in Trash"
5543
  msgstr ""
5544
 
5545
+ #: inc/custom-post-types/lesson.php:247
5546
  msgid "Lesson Settings"
5547
  msgstr ""
5548
 
5549
+ #: inc/custom-post-types/lesson.php:251
5550
  msgid "Lesson Duration"
5551
  msgstr ""
5552
 
5553
+ #: inc/custom-post-types/lesson.php:255
5554
  msgid "Duration of the lesson. Set 0 to disable."
5555
  msgstr ""
5556
 
5557
+ #: inc/custom-post-types/lesson.php:259
5558
  msgid "Preview Lesson"
5559
  msgstr ""
5560
 
5561
+ #: inc/custom-post-types/lesson.php:262
5562
  msgid ""
5563
  "If this is a preview lesson, then student can view this lesson content "
5564
  "without taking the course."
5565
  msgstr ""
5566
 
5567
+ #: inc/custom-post-types/lesson.php:335
5568
  msgid "Format"
5569
  msgstr ""
5570
 
5571
+ #: inc/custom-post-types/lesson.php:379
5572
  msgid "Standard"
5573
  msgstr ""
5574
 
5575
+ #: inc/custom-post-types/lesson.php:457
5576
  msgid "Please enter the title of the lesson"
5577
  msgstr ""
5578
 
5579
+ #: inc/custom-post-types/lesson.php:499 inc/custom-post-types/question.php:524
5580
+ #: inc/custom-post-types/quiz.php:608
5581
  msgid "Assigned"
5582
  msgstr ""
5583
 
5585
  msgid "Order number, user name, user email, course name etc..."
5586
  msgstr ""
5587
 
5588
+ #: inc/custom-post-types/order.php:580
5589
  msgid "Processing..."
5590
  msgstr ""
5591
 
5592
+ #: inc/custom-post-types/order.php:597 inc/custom-post-types/order.php:600
5593
  msgid "Apply"
5594
  msgstr ""
5595
 
5596
+ #: inc/custom-post-types/order.php:638 inc/custom-post-types/order.php:853
5597
  msgid "View Order"
5598
  msgstr ""
5599
 
5600
+ #: inc/custom-post-types/order.php:646
5601
  msgid "View child orders"
5602
  msgstr ""
5603
 
5604
+ #: inc/custom-post-types/order.php:714 inc/custom-post-types/order.php:849
5605
  #: templates/profile/tabs/orders/list.php:32
5606
  msgid "Order"
5607
  msgstr ""
5608
 
5609
+ #: inc/custom-post-types/order.php:715
5610
  msgid "Student"
5611
  msgstr ""
5612
 
5613
+ #: inc/custom-post-types/order.php:767 inc/order/class-lp-order.php:508
5614
  msgid "(Guest)"
5615
  msgstr ""
5616
 
5617
+ #: inc/custom-post-types/order.php:798
5618
+ #: templates/checkout/order-received.php:43
5619
  msgid "Course does not exist"
5620
  msgstr ""
5621
 
5622
+ #: inc/custom-post-types/order.php:812
5623
+ #: templates/checkout/order-received.php:57
5624
  msgid "(No item)"
5625
  msgstr ""
5626
 
5627
+ #: inc/custom-post-types/order.php:820
5628
  #, php-format
5629
  msgid "Pay via <strong>%s</strong>"
5630
  msgstr ""
5631
 
5632
+ #: inc/custom-post-types/order.php:850
5633
  msgid "Add New Order"
5634
  msgstr ""
5635
 
5636
+ #: inc/custom-post-types/order.php:851 inc/custom-post-types/order.php:934
5637
  #: templates/order/order-details.php:23
5638
  msgid "Order Details"
5639
  msgstr ""
5640
 
5641
+ #: inc/custom-post-types/order.php:855
5642
  msgid "Update Order"
5643
  msgstr ""
5644
 
5645
+ #: inc/custom-post-types/order.php:856
5646
  msgid "Search Orders"
5647
  msgstr ""
5648
 
5649
+ #: inc/custom-post-types/order.php:857
5650
  msgid "No order found"
5651
  msgstr ""
5652
 
5653
+ #: inc/custom-post-types/order.php:858
5654
  msgid "No order found in Trash"
5655
  msgstr ""
5656
 
5657
+ #: inc/custom-post-types/order.php:935
5658
  msgid "Order Actions"
5659
  msgstr ""
5660
 
5661
+ #: inc/custom-post-types/question.php:138 inc/custom-post-types/quiz.php:180
5662
+ #: inc/question/class-lp-question.php:567
5663
+ msgid "New Option"
5664
+ msgstr ""
5665
+
5666
+ #: inc/custom-post-types/question.php:153
5667
  #: inc/updates/_update-from-0.9.php:1216
5668
  msgid "Question Tag"
5669
  msgstr ""
5670
 
5671
+ #: inc/custom-post-types/question.php:156
5672
  #: inc/updates/_update-from-0.9.php:1197 inc/updates/_update-from-0.9.php:1219
5673
  msgid "Add New Tag"
5674
  msgstr ""
5675
 
5676
+ #: inc/custom-post-types/question.php:157
5677
  #: inc/updates/_update-from-0.9.php:1198 inc/updates/_update-from-0.9.php:1220
5678
  msgid "All Tags"
5679
  msgstr ""
5680
 
5681
+ #: inc/custom-post-types/question.php:175
5682
+ #: inc/custom-post-types/question.php:176
5683
  msgid "Question Bank"
5684
  msgstr ""
5685
 
5686
+ #: inc/custom-post-types/question.php:177 inc/custom-post-types/quiz.php:183
5687
  #: templates/content-quiz/progress.php:43
5688
  msgid "Question"
5689
  msgstr ""
5690
 
5691
+ #: inc/custom-post-types/question.php:179
5692
  msgid "View Question"
5693
  msgstr ""
5694
 
5695
+ #: inc/custom-post-types/question.php:180
5696
  msgid "Add New Question"
5697
  msgstr ""
5698
 
5699
+ #: inc/custom-post-types/question.php:182
5700
  msgid "Edit Question"
5701
  msgstr ""
5702
 
5703
+ #: inc/custom-post-types/question.php:183
5704
  msgid "Update Question"
5705
  msgstr ""
5706
 
5707
+ #: inc/custom-post-types/question.php:184
5708
  msgid "Search Questions"
5709
  msgstr ""
5710
 
5711
+ #: inc/custom-post-types/question.php:185
5712
  msgid "No questions found"
5713
  msgstr ""
5714
 
5715
+ #: inc/custom-post-types/question.php:186
5716
  msgid "No questions found in trash"
5717
  msgstr ""
5718
 
5746
  msgid "No quiz found in Trash"
5747
  msgstr ""
5748
 
5749
+ #: inc/custom-post-types/quiz.php:176
5750
  msgid "Option"
5751
  msgstr ""
5752
 
5753
+ #: inc/custom-post-types/quiz.php:181
5754
+ msgid "Do you want to move question \"{{QUESTION_NAME}}\" to trash?"
5755
+ msgstr ""
5756
+
5757
+ #: inc/custom-post-types/quiz.php:226
5758
  msgid "General Settings"
5759
  msgstr ""
5760
 
5761
+ #: inc/custom-post-types/quiz.php:232
5762
+ msgid "Pagination Questions"
5763
  msgstr ""
5764
 
5765
+ #: inc/custom-post-types/quiz.php:233
5766
  msgid ""
5767
  "Show list of questions while doing quiz as ordered numbers (1, 2, 3, etc)."
5768
  msgstr ""
5769
 
5770
+ #: inc/custom-post-types/quiz.php:239
5771
  msgid "Review Questions"
5772
  msgstr ""
5773
 
5774
+ #: inc/custom-post-types/quiz.php:242
5775
  msgid "Allow re-viewing questions after completing quiz."
5776
  msgstr ""
5777
 
5778
+ #: inc/custom-post-types/quiz.php:246
5779
  msgid "Show Correct Answer"
5780
  msgstr ""
5781
 
5782
+ #: inc/custom-post-types/quiz.php:249
5783
  msgid "Show correct answer when reviewing questions."
5784
  msgstr ""
5785
 
5786
+ #: inc/custom-post-types/quiz.php:264
5787
  msgid "Duration of the quiz. Set 0 to disable."
5788
  msgstr ""
5789
 
5790
+ #: inc/custom-post-types/quiz.php:272
5791
  msgid "Passing Grade (<span>%</span>)"
5792
  msgstr ""
5793
 
5794
+ #: inc/custom-post-types/quiz.php:273
5795
  msgid "Requires user reached this point to pass the quiz."
5796
  msgstr ""
5797
 
5798
+ #: inc/custom-post-types/quiz.php:282
5799
  msgid "Re-take"
5800
  msgstr ""
5801
 
5802
+ #: inc/custom-post-types/quiz.php:285
5803
  msgid ""
5804
  "How many times the user can re-take this quiz. Set to 0 to disable re-taking"
5805
  msgstr ""
5806
 
5807
+ #: inc/custom-post-types/quiz.php:290
5808
  msgid "Archive History"
5809
  msgstr ""
5810
 
5811
+ #: inc/custom-post-types/quiz.php:293
5812
  msgid "Archive quiz results for each time."
5813
  msgstr ""
5814
 
5815
+ #: inc/custom-post-types/quiz.php:307
5816
  msgid "Show Check Answer"
5817
  msgstr ""
5818
 
5819
+ #: inc/custom-post-types/quiz.php:310
5820
  msgid ""
5821
  "Show button to check answer while doing quiz ( 0 = Disabled, -1 = Unlimited, "
5822
  "N = Number of check )."
5823
  msgstr ""
5824
 
5825
+ #: inc/custom-post-types/quiz.php:316
5826
  msgid "Show Hint"
5827
  msgstr ""
5828
 
5829
+ #: inc/custom-post-types/quiz.php:319
5830
  msgid ""
5831
  "Show button to hint answer while doing quiz ( 0 = Disabled, -1 = Unlimited, "
5832
  "N = Number of check )."
5833
  msgstr ""
5834
 
5835
+ #: inc/custom-post-types/quiz.php:385
5836
  msgid "This quiz has no questions"
5837
  msgstr ""
5838
 
5859
  #: inc/emails/class-lp-email-enrolled-course-admin.php:28
5860
  #: inc/emails/class-lp-email-finished-course-admin.php:28
5861
  #: inc/emails/class-lp-email-new-order-admin.php:27
 
5862
  msgid "Admin"
5863
  msgstr ""
5864
 
5900
  #: inc/emails/class-lp-email-finished-course-user.php:27
5901
  #: inc/emails/class-lp-email-new-order-user.php:27
5902
  #: inc/emails/class-lp-email-processing-order-user.php:26
 
5903
  msgid "User"
5904
  msgstr ""
5905
 
6000
  msgstr ""
6001
 
6002
  #: inc/emails/class-lp-email-new-course.php:137
6003
+ #: inc/emails/class-lp-email.php:1002
6004
  msgid "Recipient(s)"
6005
  msgstr ""
6006
 
6007
  #: inc/emails/class-lp-email-new-course.php:141
6008
+ #: inc/emails/class-lp-email.php:1006
6009
  #, php-format
6010
  msgid "Email recipient(s) (separated by comma), default: <code>%s</code>."
6011
  msgstr ""
6016
  #: inc/emails/class-lp-email-updated-course.php:174
6017
  #: inc/emails/class-lp-email-user-order-changed-status.php:146
6018
  #: inc/emails/class-lp-email-user-order-completed.php:147
6019
+ #: inc/emails/class-lp-email.php:1023
 
 
 
6020
  #, php-format
6021
  msgid "Email subject, default: <code>%s</code>."
6022
  msgstr ""
6027
  #: inc/emails/class-lp-email-updated-course.php:187
6028
  #: inc/emails/class-lp-email-user-order-changed-status.php:159
6029
  #: inc/emails/class-lp-email-user-order-completed.php:160
6030
+ #: inc/emails/class-lp-email.php:1036
 
 
 
6031
  msgid "Heading"
6032
  msgstr ""
6033
 
6037
  #: inc/emails/class-lp-email-updated-course.php:191
6038
  #: inc/emails/class-lp-email-user-order-changed-status.php:163
6039
  #: inc/emails/class-lp-email-user-order-completed.php:164
6040
+ #: inc/emails/class-lp-email.php:1040
 
 
 
6041
  #, php-format
6042
  msgid "Email heading, default: <code>%s</code>."
6043
  msgstr ""
6165
  msgid "Your order {{order_number}} is completed"
6166
  msgstr ""
6167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6168
  #: inc/gateways/class-lp-gateway-abstract.php:244
6169
  msgid "%s has been deprecated. Please use % instead of."
6170
  msgstr ""
6199
  msgid "Every %d minutes"
6200
  msgstr ""
6201
 
6202
+ #: inc/libraries/meta-box/inc/core.php:39
6203
  #: inc/libraries/meta-box/inc/about/sections/getting-started.php:26
6204
  msgid "Extensions"
6205
  msgstr ""
6206
 
6207
+ #: inc/libraries/meta-box/inc/field.php:359
6208
  msgid "+ Add more"
6209
  msgstr ""
6210
 
6307
  msgid "Click me"
6308
  msgstr ""
6309
 
6310
+ #: inc/libraries/meta-box/inc/fields/file-input.php:20
6311
  msgid "Select File"
6312
  msgstr ""
6313
 
6321
  msgid "You may only upload maximum %d files"
6322
  msgstr ""
6323
 
6324
+ #: inc/libraries/meta-box/inc/fields/file.php:53
6325
  msgid "Error: Cannot delete file"
6326
  msgstr ""
6327
 
6328
+ #: inc/libraries/meta-box/inc/fields/file.php:66
6329
  msgctxt "file upload"
6330
  msgid "+ Add new file"
6331
  msgstr ""
6332
 
6333
+ #: inc/libraries/meta-box/inc/fields/file.php:121
6334
  msgctxt "file upload"
6335
  msgid "Delete"
6336
  msgstr ""
6337
 
6338
+ #: inc/libraries/meta-box/inc/fields/file.php:122
6339
  msgctxt "file upload"
6340
  msgid "Edit"
6341
  msgstr ""
6342
 
6343
+ #: inc/libraries/meta-box/inc/fields/input-list.php:90
6344
  msgid "Select All / None"
6345
  msgstr ""
6346
 
6347
+ #: inc/libraries/meta-box/inc/fields/key-value.php:132
6348
  msgid "Key"
6349
  msgstr ""
6350
 
6351
+ #: inc/libraries/meta-box/inc/fields/key-value.php:133
6352
  msgid "Value"
6353
  msgstr ""
6354
 
6355
+ #: inc/libraries/meta-box/inc/fields/map.php:73
6356
  msgid "Find Address"
6357
  msgstr ""
6358
 
6410
  msgid "Embed HTML not available."
6411
  msgstr ""
6412
 
6413
+ #: inc/libraries/meta-box/inc/fields/post.php:36
6414
  msgid "Select a post"
6415
  msgstr ""
6416
 
6417
+ #: inc/libraries/meta-box/inc/fields/post.php:41
6418
+ #: inc/libraries/meta-box/inc/fields/taxonomy.php:55
6419
  #, php-format
6420
  msgid "Select a %s"
6421
  msgstr ""
6428
  msgid "None"
6429
  msgstr ""
6430
 
6431
+ #: inc/libraries/meta-box/inc/fields/taxonomy.php:50
6432
  msgid "Select a term"
6433
  msgstr ""
6434
 
 
 
 
 
 
6435
  #: inc/libraries/meta-box/inc/fields/user.php:30
6436
  msgid "Select an user"
6437
  msgstr ""
6589
  msgid "Single Choice"
6590
  msgstr ""
6591
 
 
 
 
 
6592
  #: inc/question/class-lp-question.php:585
6593
  msgid "First option"
6594
  msgstr ""
6714
  msgid "question-tag"
6715
  msgstr ""
6716
 
6717
+ #: inc/user/abstract-lp-user.php:378
6718
  msgid "You cannot start a quiz in preview mode."
6719
  msgstr ""
6720
 
6721
+ #: inc/user/abstract-lp-user.php:385
6722
  msgid "Course does not exist or does not contain the quiz"
6723
  msgstr ""
6724
 
6725
+ #: inc/user/abstract-lp-user.php:390
6726
  msgid "User has already finished the course of this quiz"
6727
  msgstr ""
6728
 
6729
+ #: inc/user/abstract-lp-user.php:396
6730
  msgid "User has started or completed quiz"
6731
  msgstr ""
6732
 
6733
+ #: inc/user/abstract-lp-user.php:403
6734
  msgid "You have to login for starting quiz."
6735
  msgstr ""
6736
 
6737
+ #: inc/user/abstract-lp-user.php:420
6738
  msgid "Start quiz failed!"
6739
  msgstr ""
6740
 
6741
+ #: inc/user/abstract-lp-user.php:457
6742
  msgid "Course is not exists or does not contain the quiz"
6743
  msgstr ""
6744
 
6745
+ #: inc/user/abstract-lp-user.php:462
6746
  msgid "User has already finished course of this quiz"
6747
  msgstr ""
6748
 
6749
+ #: inc/user/abstract-lp-user.php:468
6750
  msgid "User has completed quiz"
6751
  msgstr ""
6752
 
6753
+ #: inc/user/abstract-lp-user.php:510
6754
  msgid "Course does not exist or does not contain the quiz."
6755
  msgstr ""
6756
 
6757
+ #: inc/user/abstract-lp-user.php:515
6758
  msgid "You can not redo a quiz in a finished course."
6759
  msgstr ""
6760
 
6761
+ #: inc/user/abstract-lp-user.php:521
6762
  #, php-format
6763
  msgid "%s::%s - User has not completed quiz."
6764
  msgstr ""
6765
 
6766
+ #: inc/user/abstract-lp-user.php:1131
6767
  msgid "You can not hint question."
6768
  msgstr ""
6769
 
6770
+ #: inc/user/abstract-lp-user.php:1543 inc/user/abstract-lp-user.php:1893
6771
+ #: inc/user/abstract-lp-user.php:1905
6772
  #, php-format
6773
  msgid "The role %s for user doesn't exist"
6774
  msgstr ""
6775
 
6776
+ #: inc/user/abstract-lp-user.php:2237
6777
  msgid "You can not complete a preview lesson."
6778
  msgstr ""
6779
 
6780
+ #: inc/user/abstract-lp-user.php:2264
6781
  msgid "You have already completed this lesson"
6782
  msgstr ""
6783
 
6784
+ #: inc/user/abstract-lp-user.php:2568 inc/user/abstract-lp-user.php:2572
6785
  msgid "Failed to enroll course."
6786
  msgstr ""
6787
 
6788
+ #: inc/user/abstract-lp-user.php:2576
6789
  msgid "Please login to enroll course."
6790
  msgstr ""
6791
 
6805
  msgid "Account publicity updated successful."
6806
  msgstr ""
6807
 
6808
+ #: inc/user/class-lp-profile.php:835
6809
  msgid "Not enrolled"
6810
  msgstr ""
6811
 
6813
  msgid "Every 3 Minutes"
6814
  msgstr ""
6815
 
6816
+ #: inc/user/lp-user-functions.php:163
6817
  msgctxt "User role"
6818
  msgid "Instructor"
6819
  msgstr ""
6820
 
6821
+ #: inc/user/lp-user-functions.php:382
6822
  msgid "Want to become an instructor?"
6823
  msgstr ""
6824
 
6825
+ #: inc/user/lp-user-functions.php:856
6826
  msgid "Only"
6827
  msgstr ""
6828
 
6829
+ #: inc/user/lp-user-functions.php:856
6830
  msgid "images accepted for upload"
6831
  msgstr ""
6832
 
6833
+ #: inc/user/lp-user-functions.php:865
6834
  msgid "Images must be under"
6835
  msgstr ""
6836
 
6837
+ #: inc/user/lp-user-functions.php:865
6838
  msgid "MB in size"
6839
  msgstr ""
6840
 
6841
+ #: inc/user/lp-user-functions.php:873
6842
  msgid "Please select an image for upload"
6843
  msgstr ""
6844
 
6845
+ #: inc/user/lp-user-functions.php:902
6846
  msgid "Image is uploaded success"
6847
  msgstr ""
6848
 
6849
+ #: inc/user/lp-user-functions.php:902
6850
  msgid "Error in uploading image"
6851
  msgstr ""
6852
 
6853
+ #: inc/user/lp-user-functions.php:928 inc/user/lp-user-functions.php:959
6854
+ #: inc/user/lp-user-functions.php:975 inc/user/lp-user-functions.php:982
6855
  msgid "Thumbnail of image profile not created"
6856
  msgstr ""
6857
 
6858
+ #: inc/user/lp-user-functions.php:946
6859
  msgid "Error in cropping user picture profile"
6860
  msgstr ""
6861
 
6862
+ #: inc/user/lp-user-functions.php:1001
6863
  msgid "Profile picture is changed"
6864
  msgstr ""
6865
 
6866
+ #: inc/user/lp-user-functions.php:1045 inc/user/lp-user-functions.php:1532
6867
  msgid "Old password incorrect!"
6868
  msgstr ""
6869
 
6870
+ #: inc/user/lp-user-functions.php:1059 inc/user/lp-user-functions.php:1539
6871
  msgid "Confirmation password incorrect!"
6872
  msgstr ""
6873
 
6874
+ #: inc/user/lp-user-functions.php:1078
6875
  msgid "Your changes are saved"
6876
  msgstr ""
6877
 
6878
+ #: inc/user/lp-user-functions.php:1086
6879
  msgid "Error in update your profile info"
6880
  msgstr ""
6881
 
6882
+ #: inc/user/lp-user-functions.php:1220
6883
  msgid "Please login to enroll this course"
6884
  msgstr ""
6885
 
6886
+ #: inc/user/lp-user-functions.php:1238
6887
  msgid "You have already finished course"
6888
  msgstr ""
6889
 
6890
+ #: inc/user/lp-user-functions.php:1241
6891
  msgid "You have already enrolled in this course"
6892
  msgstr ""
6893
 
6894
+ #: inc/user-item/class-lp-user-item-quiz.php:349
6895
  msgid "Check question has reached limit."
6896
  msgstr ""
6897
 
6898
+ #: inc/user-item/class-lp-user-item-quiz.php:351
6899
  msgid "You have already checked this question."
6900
  msgstr ""
6901
 
6902
+ #: inc/user-item/class-lp-user-item.php:341
6903
+ #: inc/user-item/class-lp-user-item.php:352
6904
+ msgid "Not Enrolled"
6905
+ msgstr ""
6906
+
6907
  #: inc/widgets/course-attributes/course-attributes.php:14
6908
  msgid "Course attributes"
6909
  msgstr ""
7493
  msgid "Order Number"
7494
  msgstr ""
7495
 
7496
+ #: templates/checkout/order-received.php:75 templates/checkout/payment.php:40
7497
  #: templates/emails/order-items-table.php:40
7498
  #: templates/emails/plain/order-items-table.php:28
7499
  msgid "Payment Method"
7639
  msgid "Hint"
7640
  msgstr ""
7641
 
7642
+ #: templates/content-quiz/buttons/nav.php:32
7643
  msgctxt "quiz-question-navigation"
7644
  msgid "Prev"
7645
  msgstr ""
7646
 
7647
+ #: templates/content-quiz/buttons/nav.php:53
7648
  msgctxt "quiz-question-navigation"
7649
  msgid "Next"
7650
  msgstr ""
7651
 
7652
+ #: templates/content-quiz/buttons/nav.php:74
7653
  msgctxt "quiz-question-navigation"
7654
  msgid "Skip"
7655
  msgstr ""
7833
  msgid "Passing Grade"
7834
  msgstr ""
7835
 
7836
+ #: templates/profile/tabs/courses.php:35 templates/profile/tabs/quizzes.php:40
7837
  #: templates/profile/tabs/courses/purchased.php:41
7838
  msgid "Progress"
7839
  msgstr ""
7842
  msgid "My Quizzes"
7843
  msgstr ""
7844
 
7845
+ #: templates/profile/tabs/quizzes.php:41
7846
  msgid "Interval"
7847
  msgstr ""
7848
 
7849
+ #: templates/profile/tabs/quizzes.php:100
7850
  msgid "No quizzes!"
7851
  msgstr ""
7852
 
learnpress.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: LearnPress
4
  Plugin URI: http://thimpress.com/learnpress
5
  Description: LearnPress is a WordPress complete solution for creating a Learning Management System (LMS). It can help you to create courses, lessons and quizzes.
6
  Author: ThimPress
7
- Version: 3.0.7
8
  Author URI: http://thimpress.com
9
  Requires at least: 3.8
10
  Tested up to: 4.9.4
@@ -95,6 +95,13 @@ if ( ! class_exists( 'LearnPress' ) ) {
95
  */
96
  public $global = array();
97
 
 
 
 
 
 
 
 
98
  /**
99
  * LearnPress constructor.
100
  */
@@ -113,6 +120,70 @@ if ( ! class_exists( 'LearnPress' ) ) {
113
  $this->init_hooks();
114
  }
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  /**
117
  * Defines table names.
118
  */
@@ -159,11 +230,11 @@ if ( ! class_exists( 'LearnPress' ) ) {
159
 
160
  // Background processes
161
  require_once 'inc/abstracts/abstract-background-process.php';
162
- require_once 'inc/background-process/class-lp-background-emailer.php';
163
- require_once 'inc/background-process/class-lp-background-schedule-items.php';
164
- require_once 'inc/background-process/class-lp-background-clear-temp-users.php';
165
- require_once 'inc/background-process/class-lp-background-installer.php';
166
- require_once 'inc/background-process/class-lp-background-global.php';
167
 
168
  // curds
169
  require_once 'inc/curds/class-lp-helper-curd.php';
@@ -191,6 +262,7 @@ if ( ! class_exists( 'LearnPress' ) ) {
191
  require_once 'inc/lp-webhooks.php';
192
  require_once 'inc/class-lp-request-handler.php';
193
  require_once( 'inc/abstract-settings.php' );
 
194
 
195
  if ( is_admin() ) {
196
  require_once 'inc/admin/meta-box/class-lp-meta-box-helper.php';
@@ -262,6 +334,10 @@ if ( ! class_exists( 'LearnPress' ) ) {
262
 
263
  require_once 'inc/class-lp-widget.php';
264
 
 
 
 
 
265
  $GLOBALS['lp_query'] = $this->query = new LP_Query();
266
  }
267
 
@@ -284,7 +360,7 @@ if ( ! class_exists( 'LearnPress' ) ) {
284
  add_action( 'load-post.php', array( $this, 'load_meta_box' ), - 10 );
285
  add_action( 'load-post-new.php', array( $this, 'load_meta_box' ), - 10 );
286
  add_action( 'plugins_loaded', array( $this, 'plugin_loaded' ), - 10 );
287
- add_action( 'init', array( $this, 'maybe_flush_rewrite_rules' ), 999 );
288
  }
289
 
290
  public function error() {
@@ -298,7 +374,7 @@ if ( ! class_exists( 'LearnPress' ) ) {
298
  /**
299
  * Maybe flush rewrite rules
300
  */
301
- public function maybe_flush_rewrite_rules() {
302
  if ( get_option( 'learn-press-flush-rewrite-rules' ) == 'yes' ) {
303
  flush_rewrite_rules();
304
  delete_option( 'learn-press-flush-rewrite-rules' );
@@ -375,10 +451,13 @@ if ( ! class_exists( 'LearnPress' ) ) {
375
 
376
  foreach ( $sizes as $k => $image_size ) {
377
 
378
- $enabled = LP()->settings->get( $k );
 
 
379
 
380
- if ( $enabled !== 'yes' ) {
381
- continue;
 
382
  }
383
 
384
  if ( ! $size = LP()->settings->get( $image_size . '_image_size', array() ) ) {
@@ -409,6 +488,10 @@ if ( ! class_exists( 'LearnPress' ) ) {
409
  */
410
  public function plugin_loaded() {
411
  $this->init();
 
 
 
 
412
  // let third parties know that we're ready
413
  do_action( 'learn_press_ready' );
414
  do_action( 'learn_press_loaded', $this );
@@ -669,7 +752,3 @@ function load_learn_press() {
669
  $GLOBALS['LearnPress'] = LP();
670
 
671
 
672
- //add_action( 'wp_footer', function () {
673
- // print_r( sizeof( $GLOBALS['xxxxxxxxxxx'] ) );
674
- // echo ',', print_r( array_sum( $GLOBALS['xxxxxxxxxxx'] ) );
675
- //} );
4
  Plugin URI: http://thimpress.com/learnpress
5
  Description: LearnPress is a WordPress complete solution for creating a Learning Management System (LMS). It can help you to create courses, lessons and quizzes.
6
  Author: ThimPress
7
+ Version: 3.0.8
8
  Author URI: http://thimpress.com
9
  Requires at least: 3.8
10
  Tested up to: 4.9.4
95
  */
96
  public $global = array();
97
 
98
+ /**
99
+ * Manage all processes run in background.
100
+ *
101
+ * @var array
102
+ */
103
+ public $backgrounds = array();
104
+
105
  /**
106
  * LearnPress constructor.
107
  */
120
  $this->init_hooks();
121
  }
122
 
123
+ public function init_background_processes() {
124
+ $supports = apply_filters( 'learn-press/background-processes', array(
125
+ 'emailer' => 'emailer',
126
+ 'installer' => 'installer',
127
+ 'query-items' => 'query-items',
128
+ 'schedule-items' => 'schedule-items',
129
+ 'global' => 'global',
130
+ 'clear-temp-users' => 'clear-temp-users'
131
+ )
132
+ );
133
+
134
+ foreach ( $supports as $name => $file ) {
135
+ if ( ! file_exists( $file ) ) {
136
+ $file = LP_PLUGIN_PATH . "/inc/background-process/class-lp-background-{$file}.php";
137
+ }
138
+
139
+ if ( file_exists( $file ) ) {
140
+ $this->backgrounds[ $name ] = include $file;
141
+ }
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Add new task to a background process.
147
+ *
148
+ * @since 3.0.8
149
+ *
150
+ * @param mixed $data
151
+ * @param string $background
152
+ *
153
+ * @return LP_Abstract_Background_Process|bool
154
+ */
155
+ public function add_background_task( $data, $background = '' ) {
156
+ if ( isset( $this->backgrounds[ $background ] ) ) {
157
+ $this->backgrounds[ $background ]->push_to_queue( $data );
158
+
159
+ return $this->backgrounds[ $background ];
160
+ }
161
+
162
+ return false;
163
+ }
164
+
165
+ /**
166
+ * Return a background instance.
167
+ *
168
+ * @since 3.0.8
169
+ *
170
+ * @param string $name
171
+ *
172
+ * @return LP_Abstract_Background_Process|bool
173
+ */
174
+ public function background( $name ) {
175
+
176
+ if ( ! did_action( 'plugins_loaded' ) ) {
177
+ _doing_it_wrong( __CLASS__ . '::' . __FUNCTION__, 'should call after \'plugins_loaded\' action', '3.0.8' );
178
+ }
179
+
180
+ if ( isset( $this->backgrounds[ $name ] ) ) {
181
+ return $this->backgrounds[ $name ];
182
+ }
183
+
184
+ return false;
185
+ }
186
+
187
  /**
188
  * Defines table names.
189
  */
230
 
231
  // Background processes
232
  require_once 'inc/abstracts/abstract-background-process.php';
233
+ //require_once 'inc/background-process/class-lp-background-emailer.php';
234
+ //require_once 'inc/background-process/class-lp-background-schedule-items.php';
235
+ //require_once 'inc/background-process/class-lp-background-clear-temp-users.php';
236
+ //require_once 'inc/background-process/class-lp-background-installer.php';
237
+ //require_once 'inc/background-process/class-lp-background-global.php';
238
 
239
  // curds
240
  require_once 'inc/curds/class-lp-helper-curd.php';
262
  require_once 'inc/lp-webhooks.php';
263
  require_once 'inc/class-lp-request-handler.php';
264
  require_once( 'inc/abstract-settings.php' );
265
+ require_once( 'inc/class-lp-market-products.php' );
266
 
267
  if ( is_admin() ) {
268
  require_once 'inc/admin/meta-box/class-lp-meta-box-helper.php';
334
 
335
  require_once 'inc/class-lp-widget.php';
336
 
337
+ if ( file_exists( LP_PLUGIN_PATH . '/local-debug.php' ) ) {
338
+ include_once 'local-debug.php';
339
+ }
340
+
341
  $GLOBALS['lp_query'] = $this->query = new LP_Query();
342
  }
343
 
360
  add_action( 'load-post.php', array( $this, 'load_meta_box' ), - 10 );
361
  add_action( 'load-post-new.php', array( $this, 'load_meta_box' ), - 10 );
362
  add_action( 'plugins_loaded', array( $this, 'plugin_loaded' ), - 10 );
363
+ add_action( 'init', array( $this, 'wp_init' ), 10 );
364
  }
365
 
366
  public function error() {
374
  /**
375
  * Maybe flush rewrite rules
376
  */
377
+ public function wp_init() {
378
  if ( get_option( 'learn-press-flush-rewrite-rules' ) == 'yes' ) {
379
  flush_rewrite_rules();
380
  delete_option( 'learn-press-flush-rewrite-rules' );
451
 
452
  foreach ( $sizes as $k => $image_size ) {
453
 
454
+ // If the key is not a string consider it is an option can be turn on/off
455
+ if ( ! is_numeric( $k ) ) {
456
+ $enabled = LP()->settings->get( $k );
457
 
458
+ if ( $enabled !== 'yes' ) {
459
+ continue;
460
+ }
461
  }
462
 
463
  if ( ! $size = LP()->settings->get( $image_size . '_image_size', array() ) ) {
488
  */
489
  public function plugin_loaded() {
490
  $this->init();
491
+
492
+ // Background
493
+ $this->init_background_processes();
494
+
495
  // let third parties know that we're ready
496
  do_action( 'learn_press_ready' );
497
  do_action( 'learn_press_loaded', $this );
752
  $GLOBALS['LearnPress'] = LP();
753
 
754
 
 
 
 
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: WordPress LMS, LMS, eLearning, e-Learning, Learning Management System, LMS WordPress, Course, Courses, Quiz, Quizzes, Training, Guru, Sell Courses
5
  Requires at least: 3.8
6
  Tested up to: 4.9.5
7
- Stable tag: 3.0.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -85,7 +85,7 @@ We are developing and improving LearnPress day by day and bringing new features
85
 
86
  ###Premium add-ons for LearnPress WordPress LMS Plugin###
87
 
88
- - [Assignments add-on for LearnPress](http://thimpress.com/product/mycred-add-on-for-learnpress/) - Newly released - Allowing instructors to give assignments, homework for students and they can grade the students' work later on. The Assignments add-on is a great supplement to LearnPress and will make your course more interactive.
89
  - [myCRED add-on for LearnPress](http://thimpress.com/product/mycred-add-on-for-learnpress/) - adding myCRED support for LearnPress WordPress LMS plugin, you can add point system to your eLearning WordPress site using LearnPress + myCRED add-on.
90
  - [Certificates add-on for LearnPress](http://thimpress.com/product/certificates-add-on-for-learnpress/) - adding drag & drop certificates builder as well as selecting designed certificate for each LMS course, your student will get particular certificate when they finished a course.
91
  - [Co-instructors add-on for LearnPress](http://thimpress.com/product/co-instructors-add-on-for-learnpress/) - multiple instructors support for each LMS course.
@@ -199,6 +199,15 @@ https://www.transifex.com/projects/p/learnpress/
199
  8. Add-ons of LearnPress.
200
 
201
  == Changelog ==
 
 
 
 
 
 
 
 
 
202
 
203
  = 3.0.7 =
204
  ~ Improved: ui/ux when adding/removing course items
4
  Tags: WordPress LMS, LMS, eLearning, e-Learning, Learning Management System, LMS WordPress, Course, Courses, Quiz, Quizzes, Training, Guru, Sell Courses
5
  Requires at least: 3.8
6
  Tested up to: 4.9.5
7
+ Stable tag: 3.0.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
85
 
86
  ###Premium add-ons for LearnPress WordPress LMS Plugin###
87
 
88
+ - [Assignments add-on for LearnPress](https://thimpress.com/product/assignments-add-on-for-learnpress/) - Newly released - Allowing instructors to give assignments, homework for students and they can grade the students' work later on. The Assignments add-on is a great supplement to LearnPress and will make your course more interactive.
89
  - [myCRED add-on for LearnPress](http://thimpress.com/product/mycred-add-on-for-learnpress/) - adding myCRED support for LearnPress WordPress LMS plugin, you can add point system to your eLearning WordPress site using LearnPress + myCRED add-on.
90
  - [Certificates add-on for LearnPress](http://thimpress.com/product/certificates-add-on-for-learnpress/) - adding drag & drop certificates builder as well as selecting designed certificate for each LMS course, your student will get particular certificate when they finished a course.
91
  - [Co-instructors add-on for LearnPress](http://thimpress.com/product/co-instructors-add-on-for-learnpress/) - multiple instructors support for each LMS course.
199
  8. Add-ons of LearnPress.
200
 
201
  == Changelog ==
202
+ = 3.0.8 =
203
+ ~ Improved: get css class name for items for performance
204
+ ~ Improved: check item is blocked for performance
205
+ ~ Improved: upgrade database feature
206
+ ~ Fixed: warning message when searching posts in frontend
207
+ ~ Fixed: show 2 comments form in lesson page
208
+ ~ Fixed: content of lesson does not show if set post-format to video
209
+ ~ Fixed: some warning when getting question class with an array of post-type
210
+ ~ Fixed: mysql error when updating item's grade with value is null
211
 
212
  = 3.0.7 =
213
  ~ Improved: ui/ux when adding/removing course items
templates/checkout/order-received.php CHANGED
@@ -6,7 +6,7 @@
6
  *
7
  * @author ThimPress
8
  * @package Learnpress/Templates
9
- * @version 3.0.0
10
  */
11
 
12
  /**
@@ -18,7 +18,7 @@ defined( 'ABSPATH' ) || exit();
18
  <?php
19
  if ( isset( $order ) ) {
20
 
21
- if ( is_int( $order ) ) {
22
  $order = learn_press_get_order( $order );
23
  }
24
  ?>
@@ -31,6 +31,33 @@ if ( isset( $order ) ) {
31
  <?php echo $order->get_order_number(); ?>
32
  </td>
33
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  <tr class="date">
35
  <th><?php _e( 'Date', 'learnpress' ); ?></th>
36
  <td>
6
  *
7
  * @author ThimPress
8
  * @package Learnpress/Templates
9
+ * @version 3.0.9
10
  */
11
 
12
  /**
18
  <?php
19
  if ( isset( $order ) ) {
20
 
21
+ if ( is_int( $order ) ) {
22
  $order = learn_press_get_order( $order );
23
  }
24
  ?>
31
  <?php echo $order->get_order_number(); ?>
32
  </td>
33
  </tr>
34
+ <tr class="item">
35
+ <th><?php _e( 'Item', 'learnpress' ); ?></th>
36
+ <td>
37
+ <?php
38
+ $links = array();
39
+ $items = $order->get_items();
40
+ $count = sizeof( $items );
41
+ foreach ( $items as $item ) {
42
+ if ( empty( $item['course_id'] ) || get_post_type( $item['course_id'] ) !== LP_COURSE_CPT ) {
43
+ $links[] = __( 'Course does not exist', 'learnpress' );
44
+ } else {
45
+ $link = '<a href="' . get_the_permalink( $item['course_id'] ) . '">' . get_the_title( $item['course_id'] ) . ' (#' . $item['course_id'] . ')' . '</a>';
46
+ if ( $count > 1 ) {
47
+ $link = sprintf( '<li>%s</li>', $link );
48
+ }
49
+ $links[] = $link;
50
+ }
51
+ }
52
+ if ( $count > 1 ) {
53
+ echo sprintf( '<ol>%s</ol>', join( "", $links ) );
54
+ } elseif ( 1 == $count ) {
55
+ echo join( "", $links );
56
+ } else {
57
+ echo __( '(No item)', 'learnpress' );
58
+ } ?>
59
+ </td>
60
+ </tr>
61
  <tr class="date">
62
  <th><?php _e( 'Date', 'learnpress' ); ?></th>
63
  <td>
templates/content-question/multi-choice/answer-options.php CHANGED
@@ -23,6 +23,7 @@ if ( ! $answers = $question->get_answers() ) {
23
  $quiz = LP_Global::course_item_quiz();
24
  $question->setup_data( $quiz->get_id() );
25
 
 
26
  ?>
27
 
28
  <ul id="answer-options-<?php echo $question->get_id(); ?>" <?php echo $answers->answers_class(); ?>>
23
  $quiz = LP_Global::course_item_quiz();
24
  $question->setup_data( $quiz->get_id() );
25
 
26
+
27
  ?>
28
 
29
  <ul id="answer-options-<?php echo $question->get_id(); ?>" <?php echo $answers->answers_class(); ?>>
templates/content-quiz/buttons/check.php CHANGED
@@ -51,7 +51,6 @@ $button_text = $checked ? __( 'Checked', 'learnpress' ) : __( 'Check', 'learnpre
51
  <?php LP_Nonce_Helper::quiz_action( 'check-answer', $quiz->get_id(), get_the_ID(), true ); ?>
52
 
53
  <input type="hidden" name="question-id" value="<?php echo $question->get_id(); ?>">
54
- <input type="hidden" name="question-id" value="<?php echo $question->get_id(); ?>">
55
 
56
  </form>
57
 
51
  <?php LP_Nonce_Helper::quiz_action( 'check-answer', $quiz->get_id(), get_the_ID(), true ); ?>
52
 
53
  <input type="hidden" name="question-id" value="<?php echo $question->get_id(); ?>">
 
54
 
55
  </form>
56
 
templates/content-quiz/buttons/nav.php CHANGED
@@ -14,9 +14,10 @@
14
  */
15
  defined( 'ABSPATH' ) || exit();
16
 
17
- $user = LP_Global::user();
18
- $quiz = LP_Global::course_item_quiz();
19
- $course_id = get_the_ID();
 
20
  ?>
21
 
22
  <?php if ( $prev_id = $user->get_prev_question( $quiz->get_id(), $course_id ) ) { ?>
@@ -29,6 +30,7 @@ $course_id = get_the_ID();
29
  <?php do_action( 'learn-press/quiz/begin-prev-question-button' ); ?>
30
 
31
  <button type="submit"><?php echo esc_html_x( 'Prev', 'quiz-question-navigation', 'learnpress' ); ?></button>
 
32
 
33
  <?php do_action( 'learn-press/quiz/end-prev-question-button' ); ?>
34
 
@@ -49,6 +51,7 @@ $course_id = get_the_ID();
49
  <?php do_action( 'learn-press/quiz/begin-next-question-button' ); ?>
50
 
51
  <button type="submit"><?php echo esc_html_x( 'Next', 'quiz-question-navigation', 'learnpress' ); ?></button>
 
52
 
53
  <?php do_action( 'learn-press/quiz/end-next-question-button' ); ?>
54
 
@@ -69,6 +72,7 @@ $course_id = get_the_ID();
69
  <?php do_action( 'learn-press/quiz/begin-skip-question-button' ); ?>
70
 
71
  <button type="submit"><?php echo esc_html_x( 'Skip', 'quiz-question-navigation', 'learnpress' ); ?></button>
 
72
 
73
  <?php do_action( 'learn-press/quiz/end-skip-question-button' ); ?>
74
 
14
  */
15
  defined( 'ABSPATH' ) || exit();
16
 
17
+ $user = LP_Global::user();
18
+ $quiz = LP_Global::course_item_quiz();
19
+ $course_id = get_the_ID();
20
+ $current_question_id = $quiz->get_viewing_question( 'id' );
21
  ?>
22
 
23
  <?php if ( $prev_id = $user->get_prev_question( $quiz->get_id(), $course_id ) ) { ?>
30
  <?php do_action( 'learn-press/quiz/begin-prev-question-button' ); ?>
31
 
32
  <button type="submit"><?php echo esc_html_x( 'Prev', 'quiz-question-navigation', 'learnpress' ); ?></button>
33
+ <input type="hidden" name="question-id" value="<?php echo $current_question_id; ?>">
34
 
35
  <?php do_action( 'learn-press/quiz/end-prev-question-button' ); ?>
36
 
51
  <?php do_action( 'learn-press/quiz/begin-next-question-button' ); ?>
52
 
53
  <button type="submit"><?php echo esc_html_x( 'Next', 'quiz-question-navigation', 'learnpress' ); ?></button>
54
+ <input type="hidden" name="question-id" value="<?php echo $current_question_id; ?>">
55
 
56
  <?php do_action( 'learn-press/quiz/end-next-question-button' ); ?>
57
 
72
  <?php do_action( 'learn-press/quiz/begin-skip-question-button' ); ?>
73
 
74
  <button type="submit"><?php echo esc_html_x( 'Skip', 'quiz-question-navigation', 'learnpress' ); ?></button>
75
+ <input type="hidden" name="question-id" value="<?php echo $current_question_id; ?>">
76
 
77
  <?php do_action( 'learn-press/quiz/end-skip-question-button' ); ?>
78
 
templates/content-quiz/history.php CHANGED
@@ -21,7 +21,7 @@ $course = learn_press_get_the_course();
21
  $quiz = LP()->global['course-item'];
22
  ?>
23
 
24
- <?php if ( ! $quiz->retake_count || ! $user->has( 'completed-quiz', $quiz->id, $course->get_id() ) ) {
25
  return;
26
  } ?>
27
 
21
  $quiz = LP()->global['course-item'];
22
  ?>
23
 
24
+ <?php if ( ! $quiz->retake_count || ! $user->has_completed_quiz( $quiz->id, $course->get_id() ) ) {
25
  return;
26
  } ?>
27
 
templates/content-quiz/progress.php CHANGED
@@ -6,7 +6,7 @@
6
  *
7
  * @author ThimPress
8
  * @package Learnpress/Templates
9
- * @version 3.0.0
10
  */
11
 
12
  /**
@@ -44,15 +44,13 @@ $percent = $quiz_data->get_questions_answered( true );
44
  </span>
45
  </div>
46
  <div class="progress-item quiz-countdown">
47
- <span class="progress-number"> --:--:-- </span>
48
  <span class="progress-label">
49
- <?php
50
- if ( $duration = $quiz_data->get_time_remaining() ) {
51
  _e( 'Time remaining', 'learnpress' );
52
  } else {
53
- echo __( 'Unlimited', 'learnpress' );
54
- }
55
- ?>
56
  </span>
57
  </div>
58
  </div>
6
  *
7
  * @author ThimPress
8
  * @package Learnpress/Templates
9
+ * @version 3.0.8
10
  */
11
 
12
  /**
44
  </span>
45
  </div>
46
  <div class="progress-item quiz-countdown">
47
+ <span class="progress-number"> <?php _e( 'Unlimited', 'learnpress' ); ?> </span>
48
  <span class="progress-label">
49
+ <?php if ( $quiz->get_duration()->get_seconds() ) {
 
50
  _e( 'Time remaining', 'learnpress' );
51
  } else {
52
+ _e( 'Duration Unlimited', 'learnpress' );
53
+ } ?>
 
54
  </span>
55
  </div>
56
  </div>
templates/content-quiz/question-numbers.php CHANGED
@@ -14,27 +14,24 @@
14
  */
15
  defined( 'ABSPATH' ) || exit();
16
 
17
- $quiz = LP_Global::course_item_quiz();
18
- $questions = $quiz->get_questions();
19
- $position = 0;
20
- ?>
21
 
22
- <ul class="question-numbers">
 
 
23
 
24
- <?php foreach ( $questions as $question_id ) {
25
- $position ++;
26
- $class = array( "question-" . $position );
27
 
28
- if ( $quiz->is_viewing_question( $question_id ) ) {
29
- $class[] = 'current';
30
- } ?>
31
 
 
 
32
  <li class="<?php echo join( ' ', $class ); ?>">
33
  <a href="<?php echo $quiz->get_question_link( $question_id ); ?>">
34
  <span><?php echo $position; ?></span>
35
  </a>
36
  </li>
37
-
38
  <?php } ?>
39
 
40
  </ul>
14
  */
15
  defined( 'ABSPATH' ) || exit();
16
 
17
+ $quiz = LP_Global::course_item_quiz();
 
 
 
18
 
19
+ if ( ! $questions = $quiz->get_questions() ) {
20
+ return;
21
+ }
22
 
23
+ $questions = array_values( $questions );
24
+ ?>
 
25
 
26
+ <ul class="question-numbers">
 
 
27
 
28
+ <?php foreach ( $questions as $position => $question_id ) {
29
+ $class = $quiz->get_question_number_class( $question_id, ++ $position ); ?>
30
  <li class="<?php echo join( ' ', $class ); ?>">
31
  <a href="<?php echo $quiz->get_question_link( $question_id ); ?>">
32
  <span><?php echo $position; ?></span>
33
  </a>
34
  </li>
 
35
  <?php } ?>
36
 
37
  </ul>
templates/emails/email-footer.php CHANGED
@@ -9,7 +9,9 @@
9
 
10
  defined('ABSPATH') or exit();
11
 
12
- $email = LP_Emails::get_email('new-order-guest');
 
 
13
  ?>
14
  </td>
15
  </tr>
9
 
10
  defined('ABSPATH') or exit();
11
 
12
+ if ( ! $email = LP_Emails::instance()->get_current() ) {
13
+ return;
14
+ }
15
  ?>
16
  </td>
17
  </tr>
templates/emails/email-header.php CHANGED
@@ -2,7 +2,10 @@
2
  if ( ! defined( 'ABSPATH' ) ) {
3
  exit; // Exit if accessed directly
4
  }
5
- $email = LP_Emails::instance()->get_current();
 
 
 
6
  ?>
7
  <!DOCTYPE html>
8
  <html dir="<?php echo is_rtl() ? 'rtl' : 'ltr' ?>">
@@ -29,7 +32,7 @@ $email = LP_Emails::instance()->get_current();
29
  <tr>
30
  <td align="center" valign="top">
31
  <h2 class="order-heading">
32
- <?php echo $email->get_heading(); ?>
33
  </h2>
34
  </td>
35
  </tr>
2
  if ( ! defined( 'ABSPATH' ) ) {
3
  exit; // Exit if accessed directly
4
  }
5
+
6
+ if ( ! $email = LP_Emails::instance()->get_current() ) {
7
+ return;
8
+ }
9
  ?>
10
  <!DOCTYPE html>
11
  <html dir="<?php echo is_rtl() ? 'rtl' : 'ltr' ?>">
32
  <tr>
33
  <td align="center" valign="top">
34
  <h2 class="order-heading">
35
+ <?php echo $email->get_heading(); ?>
36
  </h2>
37
  </td>
38
  </tr>
templates/global/blank-comments.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This template for hide the comment
4
+ */
templates/{content-lesson → global}/block-content.php RENAMED
@@ -4,7 +4,7 @@
4
  *
5
  * This template can be overridden by copying it to yourtheme/learnpress/content-lesson/block-content.php.
6
  *
7
- * @author ThimPress
8
  * @package Learnpress/Templates
9
  * @version 3.0.0
10
  */
@@ -13,5 +13,7 @@
13
  * Prevent loading this file directly
14
  */
15
  defined( 'ABSPATH' ) || exit();
16
-
17
- learn_press_display_message( __( 'This lesson has been locked', 'learnpress' ), 'error' );
 
 
4
  *
5
  * This template can be overridden by copying it to yourtheme/learnpress/content-lesson/block-content.php.
6
  *
7
+ * @author ThimPress
8
  * @package Learnpress/Templates
9
  * @version 3.0.0
10
  */
13
  * Prevent loading this file directly
14
  */
15
  defined( 'ABSPATH' ) || exit();
16
+ ?>
17
+ <div class="learn-press-content-protected-message content-item-block">
18
+ <?php esc_html_e( 'Content of this item has blocked because the course has exceeded duration.', 'learnpress' ); ?>
19
+ </div>
templates/global/comments.php ADDED
File without changes
templates/global/scripts.php CHANGED
@@ -16,7 +16,7 @@ defined( 'ABSPATH' ) || exit();
16
  ?>
17
 
18
  <script type="text/javascript">
19
- jQuery(function () {
20
  <?php echo $code;?>
21
  });
22
  </script>
16
  ?>
17
 
18
  <script type="text/javascript">
19
+ jQuery(function ($) {
20
  <?php echo $code;?>
21
  });
22
  </script>
templates/profile/tabs/quizzes.php CHANGED
@@ -56,7 +56,7 @@ $query = $profile->query_quizzes( array( 'status' => $filter_status ) );
56
  <?php }
57
  } ?>
58
  </td>
59
- <td class="column-quiz">
60
  <?php if ( $courses ) {
61
  foreach ( $courses as $course ) {
62
  $course = LP_Course::get_course( $course->ID ); ?>
@@ -78,15 +78,12 @@ $query = $profile->query_quizzes( array( 'status' => $filter_status ) );
78
  <?php echo( $user_quiz->get_time_interval( 'display' ) ); ?>
79
  </td>
80
  </tr>
81
- <?php continue; ?>
82
- <tr>
83
- <td colspan="4"></td>
84
- </tr>
85
  <?php } ?>
86
  </tbody>
87
  <tfoot>
88
  <tr class="list-table-nav">
89
- <td colspan="2" class="nav-text">
90
  <?php echo $query->get_offset_text(); ?>
91
  </td>
92
  <td colspan="2" class="nav-pages">
56
  <?php }
57
  } ?>
58
  </td>
59
+ <td class="column-quiz column-quiz-<?php echo $user_quiz->get_id();?>">
60
  <?php if ( $courses ) {
61
  foreach ( $courses as $course ) {
62
  $course = LP_Course::get_course( $course->ID ); ?>
78
  <?php echo( $user_quiz->get_time_interval( 'display' ) ); ?>
79
  </td>
80
  </tr>
81
+
 
 
 
82
  <?php } ?>
83
  </tbody>
84
  <tfoot>
85
  <tr class="list-table-nav">
86
+ <td colspan="3" class="nav-text">
87
  <?php echo $query->get_offset_text(); ?>
88
  </td>
89
  <td colspan="2" class="nav-pages">
templates/single-course/content-item.php CHANGED
@@ -14,9 +14,14 @@
14
  */
15
  defined( 'ABSPATH' ) || exit();
16
 
17
- $user = LP_Global::user();
18
- $course_item = LP_Global::course_item();
19
- $course = LP_Global::course();
 
 
 
 
 
20
  ?>
21
 
22
  <div id="learn-press-content-item">
@@ -39,7 +44,7 @@ $course = LP_Global::course();
39
  */
40
  do_action( 'learn-press/before-course-item-content' );
41
 
42
- if ( $user->can_view_item( $course_item->get_id(), $course->get_id() ) ) {
43
  /**
44
  * @deprecated
45
  */
@@ -51,7 +56,7 @@ $course = LP_Global::course();
51
  do_action( 'learn-press/course-item-content' );
52
 
53
  } else {
54
- learn_press_get_template( 'single-course/content-protected.php' );
55
  }
56
 
57
  /**
14
  */
15
  defined( 'ABSPATH' ) || exit();
16
 
17
+ $user = LP_Global::user();
18
+ $course_item = LP_Global::course_item();
19
+ $course = LP_Global::course();
20
+ $can_view_item = $user->can_view_item( $course_item->get_id(), $course->get_id() );
21
+ $exclude_cases = apply_filters( 'learn_press/exclude_view_cases', array(
22
+ 'not-logged-in',
23
+ 'not-enrolled'
24
+ ) );
25
  ?>
26
 
27
  <div id="learn-press-content-item">
44
  */
45
  do_action( 'learn-press/before-course-item-content' );
46
 
47
+ if ( $can_view_item && ! in_array( $can_view_item, $exclude_cases ) ) {
48
  /**
49
  * @deprecated
50
  */
56
  do_action( 'learn-press/course-item-content' );
57
 
58
  } else {
59
+ learn_press_get_template( 'single-course/content-protected.php', array( 'can_view_item'=>$can_view_item ) );
60
  }
61
 
62
  /**
templates/single-course/content-protected.php CHANGED
@@ -19,7 +19,16 @@ defined( 'ABSPATH' ) || exit();
19
 
20
  <span class="icon"></span>
21
 
22
- <?php echo apply_filters( 'learn_press_content_item_protected_message',
23
- sprintf( __( 'This content is protected, please <a href="%s">login</a> and enroll course to view this content', 'learnpress' ), learn_press_get_login_url( learn_press_get_current_url() ) ) ); ?>
 
 
 
 
 
 
 
 
 
24
 
25
  </div>
19
 
20
  <span class="icon"></span>
21
 
22
+ <?php
23
+ if( $can_view_item && $can_view_item == 'not-enrolled' ){
24
+ echo apply_filters( 'learn_press_content_item_protected_message',
25
+ __( 'This content is protected, please enroll course to view this content!', 'learnpress' ) );
26
+ learn_press_course_enroll_button();
27
+ } else{
28
+ echo apply_filters( 'learn_press_content_item_protected_message',
29
+ sprintf( __( 'This content is protected, please <a href="%s">login</a> and enroll course to view this content!', 'learnpress' ), learn_press_get_login_url( learn_press_get_current_url() ) ) );
30
+
31
+ }
32
+ ?>
33
 
34
  </div>
templates/single-course/status.php CHANGED
@@ -18,7 +18,7 @@ defined( 'ABSPATH' ) || exit();
18
  $course = learn_press_get_course();
19
  $user = learn_press_get_current_user();
20
 
21
- if ( ! $user->has( 'purchased-course', $course->get_id() ) ) {
22
  return;
23
  }
24
  ?>
18
  $course = learn_press_get_course();
19
  $user = learn_press_get_current_user();
20
 
21
+ if ( ! $user->has_purchased_course( $course->get_id() ) ) {
22
  return;
23
  }
24
  ?>