Leaderboard according batches

Home Forums WPLMS AddOns WPLMS Batches Leaderboard according batches

Viewing 13 posts - 76 through 88 (of 88 total)
  • Author
    Posts
  • #240799
    ratlsadmin
    Spectator
    This reply has been marked as private.
    #240810
    Scott Lang
    Moderator
    You have to do action to your custom unit complete function:
    do_action('wplms_unit_complete',$unit_id,$course_progress,$course_id,$user_id );
    #240814
    ratlsadmin
    Spectator
    Hi Scott, You are saying I need to add this function in wplms-customizer plugin and the points will work is that correct?
    #240939
    Scott Lang
    Moderator
    Refer this function to complete unit function wplms_complete_unit(){ Which is used in the site.
    #241406
    ratlsadmin
    Spectator
    This reply has been marked as private.
    #241415
    ratlsadmin
    Spectator
    This reply has been marked as private.
    #241507
    Scott Lang
    Moderator
    Hi, We are not taking any customization. Please refer to the above function which we are using on-site. Try to use that function in API(custom API). Also, we are closing this topic as it is going as a custom request which we are not taking now. We can guide you but we can not add code to your files.
    #241519
    ratlsadmin
    Spectator
    This reply has been marked as private.
    #241602
    Scott Lang
    Moderator
    1. Create a custom endpoint(API)
    2. You need course_id, unit id, and user-id
    3. Refer to this function in vibe-course-module to complete unit:function wplms_complete_unit(){
    Please read the function code where course, unit,user-id need. Here is code to complete unit if you have unit_id,course_id,user_id
    function wplms_complete_unit_API($unit_id,$course_id,$user_id){
    $flag = apply_filters('wplms_allow_complete_unit',1,$user_id,$course_id,$unit_id);
    // Check if user has taken the course
    if(bp_course_is_member($course_id,$user_id)){
    $stop_progress = apply_filters('bp_course_stop_course_progress',true,$course_id);
    if(!empty($stop_progress)){ // Enable Next unit access
    if($flag){
    bp_course_update_user_unit_completion_time($user_id,$unit_id,$course_id,time());
    }
    $curriculum=bp_course_get_curriculum_units($course_id);
    $key = array_search($unit_id,$curriculum);
    if($key <=(count($curriculum)-1) ){ // Check if not the last unit
    $key++;
    echo $curriculum[$key];
    }
    }else{
    $curriculum=bp_course_get_curriculum_units($course_id);
    $key = array_search($unit_id,$curriculum);
    $key++;
    if($flag){
    bp_course_update_user_unit_completion_time($user_id,$unit_id,$course_id,time());
    }
    }
    $c=(count($curriculum)?count($curriculum):1);
    $course_progress = $key/$c;
    do_action('wplms_unit_complete',$unit_id,$course_progress,$course_id,$user_id );
    return true;
    }else{
    return false;
    }
    }
    #242025
    ratlsadmin
    Spectator
    This reply has been marked as private.
    #242065
    Scott Lang
    Moderator
    Please check the image 500 points already assigned. refer this:http://prntscr.com/r052l9 Make a hit again and check. It should work.
    #242068
    ratlsadmin
    Spectator
    Hi Scott, I know the points are already assigned, but the points are not reflected on the students account. I understand the code is working but the points are not reflected in the respective account. Please check that.
    #242150
    Scott Lang
    Moderator
    You have to enable setting from mycred here:http://prntscr.com/r0jb7k Also, we are closing this topic as it is going out in another direction as customization.
Viewing 13 posts - 76 through 88 (of 88 total)
  • The topic ‘Leaderboard according batches’ is closed to new replies.