Course material only visible for instructor role

Home Forums Legacy Support Support queries Setup issues Course material only visible for instructor role

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #379248
    maurigut
    Spectator
    hi, I would need to know how to publish a material in the course program that is only visible to the instructor role. Greetings.
    #379333
    Veronica
    Moderator
    hi means you want a course that the curriculum of the course is only visible to instructor! isn't it? if yes then you can do a thing create a paid course and add instructor as a student so other users can't see the content until they paid for that or create a private course and instructor as a student
    #379334
    maurigut
    Spectator
    Hi, no. What I need is that in the course view the instructor can see a section or unit only he. Example: Unit 1. (viewed by instructor and students) Unit 2. (viewed by instructor and students) Unit 3. (viewed by instructor and students) Unit 4. (Only visible to instructor) I hope it is clear what I need. Greetings.
    #379442
    Veronica
    Moderator
    ok the requirement is clear now yes this can be done with the Custom code we need to check this will provide code in some time
    #379444
    Veronica
    Moderator
    hi refer: this is how setting is added: http://prntscr.com/26p60zc unit content will not available to students: http://prntscr.com/26p6gjp add this code in wplms-customizer.php
    add_filter('wplms_course_creation_tabs','hide_unit');
    function hide_unit($tabs){
    	
    		    foreach($tabs['course_curriculum']['fields'][0]['curriculum_elements'][1]['types'] as $k=>$unit){
    		       $tabs['course_curriculum']['fields'][0]['curriculum_elements'][1]['types'][$k]['fields'][] =array(
    		            'label'=> __('Hide Unit','wplms' ),
    		            'type'=> 'showhide',
    		            'id' => 'vibe_instructor_only',
    		            'from'=>'meta',
    		            'value_type'=>'single',
    		            'style'=>'',
    		            'default'=> __('Hide Unit','wplms' ),
    		            'desc'=> __('Hide Unit for Students','wplms' )
    		        );
    		    }
    		    return $tabs;
    		}
    
    		add_filter('bp_course_api_get_user_course_status_item',function($return, $request ){
    	$body = json_decode($request->get_body(),true);
            
    
        if(!empty($body['token']) && is_numeric($request['course'])){
            
            $user = apply_filters('vibebp_api_get_user_from_token','',$body['token']);
            if(!empty($user)){
            	
            	$item_id = $request['id'];
            	
    			$inst = get_post_meta($item_id,'vibe_instructor_only',true);
    			if(!empty($inst) && $inst=='S'){
    				$inst_id = get_post_field('post_author',$item_id);
    				
    				if($inst_id!=$user->id){
    					$return =array('content'=>_x('Access not available','','wplms'),'meta'=>[]);
    				}
    			}
            }
        }
    	
    	return $return;
    },11,2);
    #379713
    maurigut
    Spectator
    HI, It works well. Super grateful for your help. Greetings!
    #379746
    Veronica
    Moderator
    Hey, We aim to improve the usability of our customer’s web-sites and we are glad to have made a contribution. If you find our information to be helpful & you wouldn’t mind leaving a review, we would really appreciate that! Here: https://themeforest.net/item/wplms-learning-management-system/reviews/6780226 closing this topic Thanks & Regards
Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Course material only visible for instructor role’ is closed to new replies.