Okay
  Public Ticket #3520731
can't complete course
Closed

Comments

  •  12
    MeesterGijs started the conversation

    Hi Alex,

    I wanted to add a PDF as a final unit to a course. Not a quiz at the end, but a unit. But now I can't get the course completion button to pop up. How come? Can you explain/help?

    Video to explainhttp://somup.com/c0XIXvgqfp

    This course: https://meestergijs.nl/cursus/lezena1/#component=course

    Is this the cause?

    3879808924.png


    Coul this code help? I don't use it currently...

    add_action('init','check_finish_course_auto_trigger');

    function check_finish_course_auto_trigger(){
      $course_id = 0;
      if(!is_user_logged_in())
        return;
      if(isset($_POST) && isset($_POST['course_id'])){
        $course_id = $_POST['course_id'];
      }
      if(isset($_POST['no_ajax_course_id'])){
        $course_id = $_POST['no_ajax_course_id'];
      }
      if(empty($course_id ) && !empty($_COOKIE['course_id'])){
        $course_id = $_COOKIE['course_id'];
      }
      if(empty($course_id))
        return;
      global $wpdb;
      $user_id = get_current_user_id();
      $user_retakes = $wpdb->get_var($wpdb->prepare("SELECT sum(meta_value) from {$wpdb->usermeta} where user_id = %d AND meta_key in ( SELECT CONCAT('quiz_retakes_',post_id) from {$wpdb->postmeta} where meta_key=%s and meta_value=%d)",$user_id ,'vibe_quiz_course',$course_id));
      if(empty($user_retakes)){
        $user_retakes = 0;
      }
      $quiz_retakes = $wpdb->get_var($wpdb->prepare("SELECT sum(meta_value) from {$wpdb->postmeta} where meta_key=%s AND post_id IN (select post_id from {$wpdb->postmeta} WHERE meta_key=%s AND meta_value=%d)",'vibe_quiz_retakes','vibe_quiz_course',$course_id));
      if(empty( $quiz_retakes)){
         $quiz_retakes = 0;
      }
      $remaining =  $quiz_retakes - $user_retakes;
      if($remaining >= 0 ){

        $tips = Wplms_Tips::init();
        remove_action('wplms_before_start_course',array($tips,'finish_course_auto_trigger'));
      }
    }

    Thanks,

    Gijs

  • [deleted] replied

    no this code cannot interfere in v4. 

    what you are asking cannot be done specifically for one course only .


  •  12
    MeesterGijs replied

    Then please... Not only answer one question but HELP ME SOLVE the issue.

    So how come, when I add a final unit, I no longer get the course completion button?

    Gijs

  • [deleted] replied

    I tried to replicate the issue at my localhost with latest h5p and wplms plugins but could not replicate can you please try to install this version of wplms h5p addon , then clear cache and then try to replciate the issue ?: 


    Attached files:  wplms-h5p.zip

  •  12
    MeesterGijs replied

    I had 2.4, not 2.5. How come I didn't get eny notifications about this?

    So I deactivated 2.4, installed and activated 2.5 Deleted site and broswer cache, emptied CDN. 

    After all this, still no button at this course when all is completed and I'm at the last element of the course: a unit.. No course completion button. 

    How come?

    Gijs

  • [deleted] replied

    hi on wp.org we have not released it yet , we will release it soon then you will get update notification.

    We will debug this further 

  •  12
    MeesterGijs replied

    Ok. I'll wait for that one..