• Resolved tlouwet


    In tutor_utils() there’s a function called ‘cancel_course_enrol’ which I’ve been utilizing:

    The issue I’m having:
    User completes a course > you cancel his course > he purchases the course again > the course is already “completed”.
    So it doesn’t show in his active courses, but in his completed courses.

    How can I set his course back to being “active” instead of “completed”?

    I’ve been looking around trying to figure out where that info is saved, but after a few hours of digging around I sadly can’t seem to find it.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Sekander Badsha


    Hey @tlouwet,

    How are you doing?

    If you think carefully, you can see that you are only deleting the user association with the course. But the users course progress is not being touched.

    The course progress data is saved in user meta. The meta key is _tutor_completed_lesson_id_${lession_id}. You have to delete that as well.

    For now, I am unable to give you an automated way. We will try to include a setting to delete all related data in future update.

    Thread Starter tlouwet


    Hi @badsha_eee

    I have just deleted the usermeta _tutor_completed_lesson_id_14010 and _tutor_completed_lesson_id_14011, the id of the 2 lessons in the course, though removing those 2 only removes the checkmark next to the lesson.
    Will be adding this to the remove-course action, I overlooked this.

    $lesson_ids = $wpdb->get_col("select post_id from wpvk_postmeta WHERE meta_key = '_tutor_course_id_for_lesson' AND meta_value = {$course_id}");
    foreach ($lesson_ids as $lesson_id) {
    	$wpdb->delete( 'wpvk_usermeta', array( 'user_id' => $user_id, 'meta_key' => '_tutor_completed_lesson_id_'.$lesson_id) );

    Noticed _lesson_reading_info also holding some info on the course, removed it too but no change there.

    After removing and re-adding the course to the user afterwards, the course still shows up in completed-courses instead of active-courses.

    I’ve looked through usermeta to find anything related to the course id, but no luck there.

    And glad to hear πŸ™‚

    • This reply was modified 1 year, 1 month ago by tlouwet.
    Plugin Support Sekander Badsha


    If we were in a good position, I would really try to get all the relevant things done. Please allow us some time. We are trying to hire more developers to speed up the development process.

    Thank you so much for your patience and cooperation πŸ™‚

    Thread Starter tlouwet


    Sure thing.
    And keep up the good work πŸ™‚

    Thread Starter tlouwet


    And found where the information was held, wpvk_comments.

    WHERE comment_agent = 'TutorLMSPlugin' 
    AND comment_type = 'course_completed' 
    AND comment_post_ID = {$course_id} 
    AND user_id = {$user_id}

    Removing the associated row brings the course back into active-courses.

    Guess I should’ve read through Utils() a bit longer ^^

    So issue solved.

    Thanks for your time as always.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Cancel Course Enrol’ is closed to new replies.