CoursePress Custom Development Suggestion Required

My client has the following needs.

They want to have an exam system where they can upload exams in different categories.
People should be added to the exam after they completed specific courses.
Than the exam randomly should ask questions, from different categories.
There is a need for a configuration interface where they can say.
Question category: A, B, C, D, E...
Number of questions together exaple 20. 5 questions from category A, 2 questions from category B...etc

The support agent told me that this will require custom development. So if any developers or SLS people tell me recommendation for the best way to do the custom development in a few minutes, that will help.

Thank you.

  • Rupok

    Hi Bela,

    I've requested one of your SLS members to have a look at this. I believe he will come up with his valuable feedback on this very soon. I'll appreciate your patience.

    Please keep in mind, our SLS people work around the clock and they have to deal with lots of critical issues and other things. So it may take a little while for them to check this and provide a feedback.

    Have a nice day. Cheers!
    Rupok

  • Panos

    Hi Bela ,

    Than the exam randomly should ask questions, from different categories.

    This is not a CoursePress feature and there's no easy way to add it. Also no easy workaround for this so you will definitely need to hire a skilled developer for this, as this exceeds the scope of our support forum.

    Following is only a suggestion, which might be close to what you need. We can't provide support for this though, you can use it as a guide or a simple suggestion.

    Some sort of workaround would be to create courses that will be the "exams", and add them in categories. (These should be excluded from courses list so students don't enroll ).

    The exam questions will be the units/modules spread in the exam-courses mentioned above. Instead of :

    5 questions from category A, 2 questions from category B...etc

    you will select course ids from those categories.

    You need to use courses so you can check progress and mark assessments. It is not possible to do this by selecting specific modules of a course.

    Now that we have the exams part, here is a suggestion about the rest of the plan.

    You need a list of course ids that are required to be completed successfully, eg an array:
    $required_course_ids = array( 10, 45, 89 );

    Every time a student completes a course, you can update a user meta field with completed courses, eg:

    add_action( 'parse_request', function( $wp ){
    
    	if ( empty( $wp->query_vars['course_completion'] ) ) {
    		return;
    	}
    
    	$student_id = get_current_user_id();
    	$required_course_ids = array( 10, 45, 89 );
    	$grant_exam_access = true;
    
    	foreach( $required_course_ids as $course_id ){
    
    		$is_enrolled = CoursePress_Data_Course::student_enrolled(
    			$student_id,
    			$course_id
    		);
    
    		if( $is_enrolled ){
    
    			$student_progress = CoursePress_Data_Student::get_completion_data( $cp->student_id, $cp->course_id );
    
      			$is_failed = CoursePress_Helper_Utility::get_array_val(
    				$student_progress,
    				'completion/failed'
    			);
    
    			if ( cp_is_true( $is_failed ) ) {
    				$grant_exam_access = false;
    			}
    
    		}
    
    	}
    
    	if( $grant_exam_access ){
    		// Student can access exam. You can update a user meta value here which indicates that he has access, or add some custom role
    	}
    
    }, 10 );

    You can create a shortcode that can be used in the Exam page. That shortcode will check if student has completed required courses and will select some random exam/course ids from course categories and auto-enroll student. That shortcode can then show the selected exam/courses links in that page.

    Hope this helps :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.