Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › How to download course as a student
- This topic has 33 replies, 4 voices, and was last updated 2 years, 5 months ago by MrVibe.
-
AuthorPosts
-
October 11, 2021 at 4:09 am #372490AdamSpectatorHey, Is it possible for students to download the course after they complete it? Is there any option available? Thank You.October 11, 2021 at 12:23 pm #372517VeronicaModeratorhi please check the video tip here: https://youtu.be/lLDs4Ue1vzU?t=57October 11, 2021 at 1:59 pm #372552AdamSpectatorbut in our site, we dont see any download icon: https://www.awesomescreenshot.com/image/14846962?key=c315884d51f4990412961f0bc21711ebOctober 11, 2021 at 2:24 pm #372553AdamSpectatorWe are not using service worker from wplms, we are using third party plugin service worker (Progressive WordPress plugin). To download course do we need wplms service worker? Progressive WordPress plugin offers complete site service worker, offline caching and we can see add to home screen option in mobile, but your built in service worker only works in pwa dahboard, though it supports offline caching but we are good in that plugin. Question is the download icon needs your service worker to be enabled or why not its not showing up? What i am missing ? Our site is: https://www.hublearn.com/October 13, 2021 at 12:38 pm #372706AdamSpectatorHello ?October 14, 2021 at 10:19 am #372778VeronicaModeratorhi pardon, I think the reply was moved in spam yes it is needed as the full video is based on that follow this: https://youtu.be/lLDs4Ue1vzU?t=154October 16, 2021 at 3:57 pm #372930AdamSpectatorHi we dont see any download icon or button in our PWA dashboard either free or paid courses! what settings we need to check ?October 18, 2021 at 2:26 pm #373018VeronicaModeratorThis reply has been marked as private.October 19, 2021 at 3:55 am #373048AdamSpectatorThis reply has been marked as private.October 19, 2021 at 9:53 am #373075VeronicaModeratorThis reply has been marked as private.October 19, 2021 at 2:13 pm #373109AdamSpectatorOkay I got it. Let me run the service worker. But your service worker runs only in PWA dashboard not the whole site. Usually we use plugin for Service Worker and it has home to screen popup in mobile mode, offline caching and push notifications. But your SW does not have add to home screen option in mobile mode.October 20, 2021 at 12:36 pm #373176VeronicaModeratorhi we can register the service worker on any page but here we have selected PWA because in PWA we can only select a single page as an offline page and we have choose PWA as an offline page so the APP can be run in offline mode as wellOctober 22, 2021 at 3:32 pm #373373AdamSpectatorI understand your point. But we wanted full site as PWA. So when user visits it from mobile, they will be shown "add to home" popup message and then they can use the site an app (Progressive Web app).October 23, 2021 at 1:32 pm #373434Anshuman SahuKeymasterPlease try adding this custom code in your wplms-customizer.php file in wplms customizer pluign :
add_action('wp_footer',function(){ if ( ! function_exists( 'get_home_path' ) ) { include_once ABSPATH . '/wp-admin/includes/file.php'; } $site_root = get_home_path(); if(file_exists($site_root.'/firebase-messaging-sw.js')){ if(vibebp_get_setting('service_workers')){ $scope = ''; //$url = vibebp_get_setting('offline_page','service_worker'); $site_url = site_url(); //$scope = str_replace($site_url.'/','',$url); if($_SERVER["DOCUMENT_ROOT"] != $site_root){ $scope = rtrim(str_replace($_SERVER["DOCUMENT_ROOT"],'', $site_root).$scope,'/').'/'; } $scope = apply_filters('vibebp_service_worker_js_scope',$scope); ?> <script>if ('serviceWorker' in navigator && window.vibebp.api.sw_enabled) { navigator.serviceWorker.getRegistrations().then(registrations => { let check = registrations.findIndex((item)=>{ return (item.active.scriptURL == window.vibebp.api.sw && item.active.state == 'activated') }); let sw_first = window.vibebp.api.sw.split('?v='); let index = registrations.findIndex((i) => {return i.active.scriptURL.indexOf(sw_first[0]) > -1 }); if(index > -1 && registrations[index].active.scriptURL.indexOf(sw_first[1]) == -1){ //unregister previous version registrations[registrations.findIndex(i => i.active.scriptURL.indexOf(sw_first[0]) > -1)].unregister(); check = -1; } //service worker registration to be called only once. if(check == -1){ navigator.serviceWorker.register(window.vibebp.api.sw,{ scope:'<?php echo $scope; ?>' }).then(function(registration) { console.log('Vibebp ServiceWorker registration successful with scope: ', registration.scope); }, function(err) { console.log('Vibebp ServiceWorker registration failed: ', err); }); }else{ console.log('Vibebp Service worker already registered & active.'); } }); }</script> <?php }else{ unlink($site_root.'/firebase-messaging-sw.js'); $delete_sw = 1; //WP_Filesystem_Direct::delete($site_root.'/firebase-messaging-sw.js'); ?> <script> navigator.serviceWorker.getRegistrations().then(function(registrations) { for(let registration of registrations) { registration.unregister(); <?php if($delete_sw){ ?> setTimeout(function(){ window.location.replace(window.location.href); }, 3000); <?php } ?> } }); if ('caches' in window) { caches.keys() .then(function(keyList) { return Promise.all(keyList.map(function(key) { return caches.delete(key); })); }) } </script> <?php } } });
October 24, 2021 at 5:24 am #373455AdamSpectatoroh thank you for the code. Appreciate. Didnt tested it out, we will test it today. But we dont have wplms customizer pluign , i believe this plugin is old. We are using latest version of wplms theme (4.099) and wplms plugin. Can I use the code in child theme fucntions.php file? Thank You. -
AuthorPosts
- The topic ‘How to download course as a student’ is closed to new replies.