leaderboard

Home Forums Legacy Support 4.0 Bugs & Issues leaderboard

Viewing 15 posts - 1 through 15 (of 36 total)
  • Author
    Posts
  • #358903
    Ernesto Lee
    Participant
    Is it possible to show course leaderboard based on all quiz taken and present on similar UI like this? Instead of individual quiz. https://share.getcloudapp.com/lluNjXKE @alex, please i need your attention
    #359174
    Anshuman Sahu
    Keymaster
    Currently exact is not available . But this can be seen in course -> statistics tab . You can choose student name and marks and then can generate stats . After this you can click on marks column to sort it.
    #359464
    Ernesto Lee
    Participant
    please refer this: https://wplms.io/support/forums/topic/course-leaderboard/ i think we can achieve this too: https://share.getcloudapp.com/lluNjXKE code is already there. just little modification i think
    #359565
    Anshuman Sahu
    Keymaster
    Well that data is already present in the stats data and we used the same query in that shortcode . You can as well use this code : https://wplms.io/support/forums/topic/course-leaderboard/#post-203406 then this shortcode [course_leaderboard course=course-id] replace your course-id with your course id .
    #359577
    Ernesto Lee
    Participant
    i know all of this. i tested this code it is not working. can you test this code in your machine and then revert back with output???
    #359722
    Anshuman Sahu
    Keymaster
    Ok there is one more parameter there in the shortcode. [course-leaderboard count="20" course="50"] where 50 is course id and count = 20 is number of items to show.
    #359758
    Ernesto Lee
    Participant
    if i want to show all courses top 10 leaderboard data then?
    #359861
    Anshuman Sahu
    Keymaster
    It already shows list students sorted by score (course marks ) just change the count param : count="10" [course-leaderboard count="10' course="50"]
    #359903
    Ernesto Lee
    Participant
    no you do not understand [course-leaderboard count="10' course="50"] course id = 50 number of people in the course to be appear for ranking: 10 ---- the issue is it shows only 1 course data. suppose we pass course-id-50 then it shows top 10 people rank in course id 50. ---- 1- i want to show the all course 200 course top 10 guys??? how is that possible. 2- i want to show this shortcode i all courses >> course description. this code limitation is i have to pass course id. i want if i place this code in course description. it should fetch the current course id. i dont want to pass the id manually in every shortcode. [course-leaderboard count="10' course=" current course id taken automatically"] please revise the shortcode.
    #359923
    MrVibe
    Keymaster
    when you say : 1. i want to show the all course 200 course top 10 guy <-- do you mean we have to sum all the scores of courses completed by all the students and then rank them ? Or we just show the top 10 from the maximum marks achieved by students in any course. 2. this is possible, but we need to know if you are using WPLMS V4 layout or v3 layouts becuase the asnwer will differ according to that
    #359939
    Ernesto Lee
    Participant
    For 2 question. i am using wplms 4. workflow: i will put the shortcode in the single course page area using elementor for course layout design. it should show the current opened single course related course leaderboard. or here in tab: https://share.getcloudapp.com/OAuQzkox
    #360081
    MrVibe
    Keymaster
    ok, this is possible , sharing code in next reply.
    #360083
    MrVibe
    Keymaster
    add_filter('wplms_get_course_tabs',function($tabs){ $tabs['leaderboard'] = 'Leaderboard'; return $tabs; }); add_filter('wplms_course_tab_data',function($data,$body,$course_id){ if($body['tab'] == 'leaderboard'){ ob_start(); do_shortcode('YOUR SHORTCODE'); $data = ob_get_clean(); } return $data; },10,3); --- This filter is missing in orignal code, added in update : wplms_plugin/includes/vibe-course-module/includes/api/class-student-controller.php line 990 add this link : return new WP_REST_Response( array('status'=>1,'data'=>apply_filters('wplms_course_tab_data','',$body,$course_id)), 200 );
    #360222
    Ernesto Lee
    Participant
    this is the shortcode [course-leaderboard count=”10′ course=” current course id taken automatically”] in your current code https://share.getcloudapp.com/ApuzNL4v or [course-leaderboard count="10'] i should write this without course id???? i am using this shortcode add_shortcode(‘course_leaderboard’,function ($atts,$content=null){ ob_start(); global $wpdb; if(!isset($atts[‘count’])){ $atts[‘count’] =10; } $students = $wpdb->get_results($wpdb->prepare(” SELECT pm.meta_key,pm.meta_value FROM {$wpdb->postmeta} AS pm LEFT JOIN {$wpdb->posts} as p ON pm.post_id = p.ID WHERE p.post_status = %s AND p.post_type = %s AND p.ID = %d AND pm.meta_key REGEXP ‘^[0-9]+$’ ORDER BY pm.meta_value DESC LIMIT 0,{$atts[‘count’]} “,’publish’,’course’,$atts[‘course’])); if(!empty($students)){ echo ‘
    ’; echo ‘
      ’; foreach ($students as $key => $stu) { $student = get_user_by(‘id’,$stu->meta_key); if(!empty($student) && !is_wp_error($student)){ echo ‘
    1. <span style=”width: 50% !important;display: inline-block; font-size: 18px;”>’.bp_core_get_user_displayname($student->ID).'</span><span style=”width: 50% !important;display: inline-block; font-size: 18px;”>’.$stu->meta_value.'</span>
    2. ’; } } echo ‘
’; } $html = ob_get_clean(); return $html; });
#360363
Anshuman Sahu
Keymaster
Well you have to add the course id to it , its necessary .
Viewing 15 posts - 1 through 15 (of 36 total)
  • The topic ‘leaderboard’ is closed to new replies.