Crash after show Back to course Button above the accordion inserted in cutomizer

Home Forums Legacy Support Support queries Other issues Crash after show Back to course Button above the accordion inserted in cutomizer

Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • #326583
    szabonyelviskola
    Spectator
    I have found the following script in your knowledge base to Show Back to course Button above the accordion: add_action(‘wplms_course_start_after_time’,‘show_back_to_course_button_above’); function show_back_to_course_button_above(){ if(!empty($_POST[“course_id”])){ $course_id=$_POST[“course_id”]; } if(empty($course_id) && !empty($_COOKIE[‘course’])){ $course_id=$_COOKIE[‘course’]; } echo ‘BACK TO COURSE’; } When I copied it to customizer plugin, my website crashed. I'm on 3.9.9 What could be the problem. When I commented out the echo part, it was no problem, so the problem should be somewhere there... This the source, I have copied from here: https://wplms.io/support/knowledge-base/show-back-to-course-button-above-the-accordion/
    #326758
    Veronica
    Moderator
    hi please add this exactly
    add_filter( 'bp_after_has_members_parse_args', 'my_bp_members_per_page' );
    
    add_action('wplms_course_start_after_time','show_back_to_course_button_above');
    function show_back_to_course_button_above(){
    if(!empty($_POST["course_id"])){
         $course_id=$_POST["course_id"];
    }
    if(empty($course_id) && !empty($_COOKIE['course'])){
       $course_id=$_COOKIE['course'];
    }
    echo '<div style=" background: #fff; color:#000; margin-top: 10px; padding:5px;"><a href="'.get_permalink($course_id).'" class=" full button">BACK TO COURSE</a></div>';
    }
    I have added the same on my local and it is working without any critical error on my site
    #327127
    szabonyelviskola
    Spectator
    Thank you! This working great! As I see the first line the add_filter was missing in my solution, but this not there in your Knowledge base. Probably it would be good to update it. Thanks again, you can close the topic.
    #327140
    szabonyelviskola
    Spectator
    I have found 2 problems!
    1. The first add_filter line is not necessary, it makes a problem on the members page. (The problem in my script was the apostrophe type. In yours was good.)

    2. The remaining script is working mainly but if somebody uses the previous unit button or after a quiz making the link connected to the button is wrong. Not the course link but only .../course-status/ And for that reason the button does not work.

    #327200
    Veronica
    Moderator
    hi can you please share the exact video of the issue you are facing so we will replicate the same with the above code
    #327309
    szabonyelviskola
    Spectator
    Hi, You will find attached the video. https://drive.google.com/file/d/1JhifNSej30Co9hYYR-idVMWagG1sZqIt/view?usp=sharing You can not check it is not visible on video, down on the screen the link connected to the button... But it became wrong after step back. It became ../course-status/ instead of the course link. Some additional information. In the course, the Drip feed is switched on if it could get any connection with the problem.
    #327458
    Veronica
    Moderator
    ooh! means that BACK TO COURSE which is added with the above code is not working right! please share the course details we will check thanks
    #327523
    szabonyelviskola
    Spectator
    Yes, the above code is not enough good. Mostly it is ok, but in some cases, it is not working well. It loses the right link of course, in some cases. If you press the previous unit button for example, or you finish a quiz and after want to use the button... I have switched this code off, because off false working, so you can not test it on my site. Please test it locally on your side, based on the activity done on my video. Check the link after activities hovering the button... It will show the wrong link after some steps...
    #328087
    szabonyelviskola
    Spectator
    Any idea, what could cause this "link missing" behavior?
    #328441
    Veronica
    Moderator
    I am implementing the same will share if I face the same issue
    #328462
    Veronica
    Moderator
    hi I have performed the same and didn't found the issue https://prnt.sc/vxggey added the exact code
    #328465
    szabonyelviskola
    Spectator
    Hi, Something should be different because in my case I have 2 Back To Course buttons. One upper and one down on the old space. The old button working correctly the new not. The problem is not coming at the first moment. Please check my video. In your picture, I see you did not move from the first unit. Please go to the next unit and after the go to the next and then to the previous and after that please check the link. At me, in these circumstances, the button loses the right course link.
    #328552
    Veronica
    Moderator
    let me provide a video here I have performed translation on the local that's why please check this: http://prntscr.com/vxzxxc providing video
    #328553
    Veronica
    Moderator
    hi please check this video https://screencast-o-matic.com/watch/cYlj1mNm5l I have performed the same steps and I think the scenario is also the same please let me know if you found any difference
    #328602
    szabonyelviskola
    Spectator
    Hi You did not perform the same steps, I think you did not understand me. Please check my video again! https://drive.google.com/file/d/1JhifNSej30Co9hYYR-idVMWagG1sZqIt/view?usp=sharing 1. Big difference between your and my video, that you have a COURSE OVERVIEW button where in my case I have the old BACK TO COURSE button. So In my case, I have 2 BACK TO COURSE buttons. One in the old place and one in the new upper place. (against the same code) 2. In your video you did not move between the curriculum elements and thus causing the problem. You have to go to the next unit with the button down and after go back to the previous unit and after check the connecting link to the Back to course button. The link is missing only if you use the next and previous unit buttons several times. One more additional information: the old BACK TO COURSE button (on the original place) is always working well even if the new button loses the right link.
Viewing 15 posts - 1 through 15 (of 26 total)
  • The topic ‘Crash after show Back to course Button above the accordion inserted in cutomizer’ is closed to new replies.