changing the course completion behavior to only show when the modal when a course...
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 31 Jul 2018 13:28:48 +0000 (09:28 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 31 Jul 2018 13:28:48 +0000 (09:28 -0400)
footer.php
functions.php
header.php
js/custom.js

index cdb9d15..1263155 100644 (file)
@@ -94,7 +94,7 @@
                                this.addEventListener("readystatechange", function() {
                                        if( (this.response.includes('quiz_finished') ) && this.readyState === 4 ){
                                                let data = JSON.parse(this.response);
-                                               if(data.pass === 1){
+                                               if(data.quiz_finished === 1){
                                                        setTimeout(function(){
                                                                $(".glm-badge-alert#quiz-badge").fadeIn("fast");
                                                                $(".glm-badge-alert#quiz-badge").addClass("shake");
                                                }
                     }
                     if( (this.response.includes('lesson_finished') ) && this.readyState === 4 ){
-                                               let data = JSON.parse(this.response);
                         setTimeout(function(){
                             $(".glm-badge-alert#lesson-badge").fadeIn("fast");
                             $(".glm-badge-alert#lesson-badge").addClass("shake");
                         }, 10000);
                     }
                     if( this.response.includes('course_finished') && this.readyState === 4 ){
-                                               let data = JSON.parse(this.response);
                         setTimeout(function(){
                             $("#glm-badge-overlay").fadeIn("fast");
                         }, 1500)
index e429781..93ac8f6 100644 (file)
@@ -289,18 +289,17 @@ function displaydate(){
 }
 add_shortcode( 'date', 'displaydate' );
 add_filter( 'show_admin_bar', '__return_false' );
-add_action("learndash_quiz_completed", function($data) {
-       $data["quiz_finished"] = "yes";
-       echo json_encode($data);
-       wp_die();
-}, 5, 1);
+// add_action("learndash_quiz_completed", function($data) {
+//     global $action_data;
+//     $action_data["quiz_finished"] = $data['pass'];
+//     echo json_encode( $action_data);
+// }, 5, 1);
 add_action("learndash_course_completed", function($data) {
-       $finished["course_finished"] = "yes";
-       echo json_encode($finished);
-       wp_die();
+    $action_data = array("course_finished" => "yes");
+       echo json_encode($action_data);
 }, 5, 1);
-add_action("learndash_lesson_completed", function($data) {
-       $finished["lesson_finished"] = "yes";
-       echo json_encode($finished);
-       wp_die();
-}, 5, 1);
\ No newline at end of file
+// add_action("learndash_lesson_completed", function($data) {
+//     $finished["lesson_finished"] = "yes";
+//     echo json_encode($finished);
+//     wp_die();
+// }, 5, 1);
\ No newline at end of file
index fb0f04a..f4b1044 100644 (file)
@@ -27,6 +27,7 @@
     $type =strtolower(str_replace(" ","-",$post->post_type));
 ?>
 <script>
+    window.post_type        = '<?php echo $type; ?>';
     window.page             = '<?php echo $page; ?>';
     window.icon_url         = '<?php echo get_template_directory_uri(); ?>';
     window.getting_started  = '<?php echo get_permalink(414); ?>';
index 0b429db..afda483 100644 (file)
@@ -215,6 +215,12 @@ jQuery(document).ready(function($){
     course_cards.on("click", function(){
         window.location = $(this).data('url');
     })
+    if(window.page === "login"){
+        $("#modal-login").remove();
+    }
+    if(window.post_type === "sfwd-lessons"){
+        $("#learndash_mark_complete_button").css("display", "none");
+    }
     // let getting_started = $(".parallax-section:nth-child(2)");
     // let login_section   = getting_started.find(".service-listing").children(".service-list:first-child");
     // login_section.addClass("parallax-hover");