Home › Forums › WPLMS AddOns › WPLMS Batches › Leaderboard according batches
- This topic has 87 replies, 8 voices, and was last updated 4 years, 2 months ago by Scott Lang.
-
AuthorPosts
-
January 28, 2020 at 6:49 am #240799ratlsadminSpectatorThis reply has been marked as private.January 28, 2020 at 8:41 am #240810Scott LangModeratorYou have to do action to your custom unit complete function:do_action('wplms_unit_complete',$unit_id,$course_progress,$course_id,$user_id );January 28, 2020 at 10:56 am #240814ratlsadminSpectatorHi Scott, You are saying I need to add this function in wplms-customizer plugin and the points will work is that correct?January 29, 2020 at 6:17 am #240939Scott LangModeratorRefer this function to complete unit function wplms_complete_unit(){ Which is used in the site.February 4, 2020 at 7:00 am #241406ratlsadminSpectatorThis reply has been marked as private.February 4, 2020 at 7:12 am #241415ratlsadminSpectatorThis reply has been marked as private.February 5, 2020 at 6:26 am #241507Scott LangModeratorHi, 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.February 5, 2020 at 6:51 am #241519ratlsadminSpectatorThis reply has been marked as private.February 6, 2020 at 6:43 am #241602Scott LangModerator
- Create a custom endpoint(API)
- You need course_id, unit id, and user-id
- Refer to this function in vibe-course-module to complete unit:function wplms_complete_unit(){
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 courseif(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 accessif($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;}}February 10, 2020 at 7:16 am #242025ratlsadminSpectatorThis reply has been marked as private.February 10, 2020 at 11:35 am #242065Scott LangModeratorPlease check the image 500 points already assigned. refer this:http://prntscr.com/r052l9 Make a hit again and check. It should work.February 10, 2020 at 12:04 pm #242068ratlsadminSpectatorHi 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.February 11, 2020 at 6:27 am #242150Scott LangModeratorYou 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. -
AuthorPosts
- The topic ‘Leaderboard according batches’ is closed to new replies.