How to download course as a student

Home Forums Legacy Support Support queries How-to & Troubleshooting How to download course as a student

Viewing 15 posts - 1 through 15 (of 34 total)
  • Author
    Posts
  • #372490
    Adam
    Spectator
    Hey, Is it possible for students to download the course after they complete it? Is there any option available? Thank You.
    #372517
    Veronica
    Moderator
    hi please check the video tip here: https://youtu.be/lLDs4Ue1vzU?t=57
    #372552
    Adam
    Spectator
    but in our site, we dont see any download icon: https://www.awesomescreenshot.com/image/14846962?key=c315884d51f4990412961f0bc21711eb
    #372553
    Adam
    Spectator
    We 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/
    #372706
    Adam
    Spectator
    Hello ?
    #372778
    Veronica
    Moderator
    hi 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=154
    #372930
    Adam
    Spectator
    Hi we dont see any download icon or button in our PWA dashboard either free or paid courses! what settings we need to check ?
    #373018
    Veronica
    Moderator
    This reply has been marked as private.
    #373048
    Adam
    Spectator
    This reply has been marked as private.
    #373075
    Veronica
    Moderator
    This reply has been marked as private.
    #373109
    Adam
    Spectator
    Okay 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.
    #373176
    Veronica
    Moderator
    hi 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 well
    #373373
    Adam
    Spectator
    I 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).
    #373434
    Anshuman Sahu
    Keymaster
    Please 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
    		}
    	} 
    });
    #373455
    Adam
    Spectator
    oh 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.
Viewing 15 posts - 1 through 15 (of 34 total)
  • The topic ‘How to download course as a student’ is closed to new replies.