Home › Forums › Legacy Support › Support queries › Other issues › Crash after show Back to course Button above the accordion inserted in cutomizer
- This topic has 25 replies, 2 voices, and was last updated 3 years, 3 months ago by Veronica.
-
AuthorPosts
-
November 26, 2020 at 9:26 am #326583szabonyelviskolaSpectatorI 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/November 27, 2020 at 6:06 am #326758VeronicaModeratorhi please add this exactly
I have added the same on my local and it is working without any critical error on my siteadd_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>'; }
November 29, 2020 at 11:43 am #327127szabonyelviskolaSpectatorThank 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.November 29, 2020 at 7:06 pm #327140szabonyelviskolaSpectatorI have found 2 problems!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.)
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.
November 30, 2020 at 7:36 am #327200VeronicaModeratorhi can you please share the exact video of the issue you are facing so we will replicate the same with the above codeNovember 30, 2020 at 5:47 pm #327309szabonyelviskolaSpectatorHi, 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.December 1, 2020 at 2:38 pm #327458VeronicaModeratorooh! means that BACK TO COURSE which is added with the above code is not working right! please share the course details we will check thanksDecember 1, 2020 at 9:55 pm #327523szabonyelviskolaSpectatorYes, 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...December 4, 2020 at 2:02 pm #328087szabonyelviskolaSpectatorAny idea, what could cause this "link missing" behavior?December 7, 2020 at 12:12 pm #328441VeronicaModeratorI am implementing the same will share if I face the same issueDecember 7, 2020 at 2:59 pm #328462VeronicaModeratorhi I have performed the same and didn't found the issue https://prnt.sc/vxggey added the exact codeDecember 7, 2020 at 3:09 pm #328465szabonyelviskolaSpectatorHi, 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.December 8, 2020 at 6:45 am #328552VeronicaModeratorlet me provide a video here I have performed translation on the local that's why please check this: http://prntscr.com/vxzxxc providing videoDecember 8, 2020 at 6:58 am #328553VeronicaModeratorhi 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 differenceDecember 8, 2020 at 12:14 pm #328602szabonyelviskolaSpectatorHi 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. -
AuthorPosts
- The topic ‘Crash after show Back to course Button above the accordion inserted in cutomizer’ is closed to new replies.