how to include a user email ID row while downloading stats under a course

Home Forums Legacy Support Support queries Setup issues how to include a user email ID row while downloading stats under a course

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #300390
    KARVYFINTECH
    Participant
    When we want download the starts there are check boxes for Date (Joining), Date (Finish), ID, Student Name, Units Status, Quiz scores, Badge, Certificate, Certificate Code, Course Progress, Course Marks, Assignment scores We want to add user email id also as row, so that we can easily filter a user with email id. (as user email is unique for every user)
    #300811
    Jackson
    Blocked
    Hello, But there is no need for user email, id also would be unique when you download a csv file , Thanks,
    #301549
    KARVYFINTECH
    Participant
    This reply has been marked as private.
    #301989
    Jackson
    Blocked
    Hello, yes, You can replace id, First download csv file and you can edit same csv after insert your own id , You can import the csv file, Thanks,
    #305052
    KARVYFINTECH
    Participant
    This reply has been marked as private.
    #309907
    Anshuman Sahu
    Keymaster
    please try adding this given code in your wplms-customizer.php file in wplms customizer plugin :
    
    add_filter('wplms_course_stats_list','add_custom_course_stat');
    add_action('wplms_course_stats_process','process_custom_course_stat',10,6);
    function add_custom_course_stat($list){
             $list['user_email']= 'Email';
             return $list;
            }
              
            function process_custom_course_stat(&$csv_title, &$csv,&$i,&$course_id,&$user_id,&$field){
              if($field != 'user_email') // Ensures the field was checked.
                 return;
              $title=__('Email','vibe');
              if(!in_array($title,$csv_title))
                $csv_title[$i]=$title;
              $ifield = 'Email'; 
              $user = get_user_by('id',$user_id);
              $field_val=$user->user_email;             
              if(isset($field_val) && $field_val)
                $csv[$i][]= $field_val;
              else
                $csv[$i][]= 'N.A';
              
             }
    #310964
    KARVYFINTECH
    Participant
    This reply has been marked as private.
    #311282
    KARVYFINTECH
    Participant
    This reply has been marked as private.
    #311777
    Anshuman Sahu
    Keymaster
    Well in course the total marks always be 100 and marks will be actually the percentage out of 100 . remove above code and add this code to have email at first place:
    add_filter('wplms_course_stats_list','add_custom_course_stat');
    add_action('wplms_course_stats_process','process_custom_course_stat',10,6);
    function add_custom_course_stat($list){
             array_splice($list, 0,0,array('email'=>'Email'));
             return $list;
            }
              
            function process_custom_course_stat(&$csv_title, &$csv,&$i,&$course_id,&$user_id,&$field){
              if($field != 'user_email') // Ensures the field was checked.
                 return;
              $title=__('Email','vibe');
              if(!in_array($title,$csv_title))
                $csv_title[$i]=$title;
              $ifield = 'Email'; 
              $user = get_user_by('id',$user_id);
              $field_val=$user->user_email;             
              if(isset($field_val) && $field_val)
                $csv[$i][]= $field_val;
              else
                $csv[$i][]= 'N.A';
              
             }
    #311998
    KARVYFINTECH
    Participant
    This reply has been marked as private.
    #312342
    Diana
    Participant
    No sir, then the query will be so long
Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘how to include a user email ID row while downloading stats under a course’ is closed to new replies.