Configure these quiz setting by admin for default for all course

Home Forums Legacy Support Support queries How-to & Troubleshooting Configure these quiz setting by admin for default for all course

Viewing 15 posts - 1 through 15 (of 23 total)
  • Author
    Posts
  • #362243
    silverchair
    Spectator
    1. When instructor creating a Quiz, I want to hide these option and I want to configure those option by Admin only for the default for all course. So I want to restrict Instructor to configure these setting. How can I do that? 2. And also, I want to hide "Search Question" for Quiz creation, because I want to force instructor to create question for each quiz, not connected to other course. Refer: https://prnt.sc/169zlml 3. I want to configure these setting (Assignment) only by admin for the default for all assignment, so hide/restrict the Instructor to change these configuration. How can I do that?
    #362261
    silverchair
    Spectator
    This reply has been marked as private.
    #362615
    Ada
    Participant
    Hi, yes, it's possible but admin have to set it from the code. It can not be set default using front-end. So whenever you will need to perform any changes you will need to change values from wplms-customizer.php file. Providing you code.
    #362620
    silverchair
    Spectator
    Okay, it's alright, that's better for me. Thx
    #362631
    silverchair
    Spectator
    For now, as a default configuration for all course: Auto Evaluate Results: Yes Number of questions per page: 1 Number of Extra Quiz Retake: 2 Post Quiz Message: Thanks for submitting your quiz, now you can move to next session/unit Show results after submission: Yes Add check answer switch: Yes Randomize quiz quiestion: Yes And please provide which value at the code I have to change when someday I want to change these configuration Thx so much...
    #362918
    Ada
    Participant
    HI, For now there is no such hook so that we can save the default setting so that instructor can not edit it . I can only share code to set default value but then you'll need to hide these settings for instructor user type so that they can not edit it.
    #362962
    silverchair
    Spectator
    Alright then, thats better for me as long as admin can change those configuration later and hide it for instructor user type...
    #363188
    Ada
    Participant
    Sharing the code.
    #363189
    Ada
    Participant
    Add it in wplms customizer.php
    
    function quiz_instructor_control(){
    	if ( !current_user_can('manage_options') ) {
    		?>
    
    		<style>
    			#course_component .course_curriculum_builder .curriculum_element_wrapper.quiz_static .field_wrapper.field_switch, .field_wrapper.field_duration, .field_wrapper.field_number, .field_wrapper.field_editor {
    			    display:none !important;
    			}
    			#course_component .curriculum_element_wrapper.quiz_dynamic .field_wrapper.field_switch, .field_wrapper.field_duration, .field_wrapper.field_number, .field_wrapper.field_editor {
    			    display:none !important;
    			}
    			</style>
    			<?php
    	}
    
    }
    add_action('wp_head','quiz_instructor_control');
    
    #363206
    silverchair
    Spectator
    Now "detailed description" is also gone https://prnt.sc/17fvrko
    #363211
    silverchair
    Spectator
    1. Detailed Description , and many field on "SETTINGS" session gone. This happen on instructor account only, for admin it works normally. 2. "Search Question" still there, refer: https://prnt.sc/17fxcwd 3. PLEASE NOTE: I know how to set LMS > Course Nav , there are some field that I set to "SHOW", but after I put this code, those field are gone. 4. I don't know is it from the code u provide here, or from this topic: https://wplms.io/support/forums/topic/dont-connect-forum-or-assignment-to-other-course-unit/page/2/ Refer: https://prnt.sc/17fvrko & https://prnt.sc/17fwizu
    #363223
    Ada
    Participant
    Hi, Please remove the code that I provided in this current topic. Actually I provided you css code so that admin can manage quiz setting values from front-end but it is causing other elements to disappear. I'll need to provide php code for this issue also.
    #363232
    silverchair
    Spectator
    Okay, that's better. So you mean you will provide css code and php code also for this?
    #363233
    silverchair
    Spectator
    Btw, your code has already removed, did you do that? Because I'm not removing it yet. It's ok if u're did that
    #363403
    Ada
    Participant
    Hi Yes, I removed that code because it was css based code that was causing other elements to disappear. You can now add this code in wplms customizer.php.
    
    
    add_filter('wplms_course_creation_tabs',function($tabs, $course_id=null, $user_id=null){
    	if($user_id && !user_can($user_id,'manage_options')){
    		$curriculum_elements = $tabs['course_curriculum']['fields'][0]['curriculum_elements'];  
        foreach ($curriculum_elements as $key => $curriculum_element) {
            if($curriculum_element['type'] == 'quiz'){
                foreach ($curriculum_element['types'] as $key1 => $quiz_type) {
                if($quiz_type['id']=='static') {
                	foreach ($quiz_type['fields'] as $key2=> $quiz_content){
                			//print_r($unit_content);
                			if($quiz_content['id']=='vibe_quiz_auto_evaluate' && !current_user_can('manage_options') ){
                				           				
                        		array_splice($curriculum_element['types'][$key1]['fields'], $key2,7);
                			}
                			         			           			
                		}
                } 
                		              
                }
                $curriculum_elements[$key] = $curriculum_element;       
            }
        }
        $tabs['course_curriculum']['fields'][0]['curriculum_elements'] = $curriculum_elements;
    
    	}
    	    return $tabs;
    	 	      
    },10,1);
    
Viewing 15 posts - 1 through 15 (of 23 total)
  • The topic ‘Configure these quiz setting by admin for default for all course’ is closed to new replies.