Add custom user field in Administration Download Reports course stats

Home Forums Legacy Support Support queries Other issues Add custom user field in Administration Download Reports course stats

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #301233
    JMG-Solutions_828
    Participant
    Hello, I’ve followed the following thread https://wplms.io/support/knowledge-base/add-custom-user-field-in-download-course-stats/ But when I download the report it comes without the "custom user fields". Please, how can I solve this? The Code I used in customizer_class.php
    
    <?php
    
    if(!class_exists('WPLMS_Customizer_Plugin_Class')){
    
    class WPLMS_Customizer_Plugin_Class{
        public function __construct(){
    
            function add_custom_course_stat($list){
       $new_list = array(
           'user_field4'=>'4',
           'user_field1'=>'1',
           'user_field10'=>'10',
           'user_field11'=>'11',
           'user_field13'=>'13',
           'user_field15'=>'15',
           'user_field16'=>'16',
           'user_field18'=>'18',
           'user_field2'=>'2'
           
                        //add another element like same above 'user_field3'=>'Gender'
                         );
       
       $list=array_merge($list,$new_list);
        return $list;
    }
            
            
             
           function process_custom_course_stat(&$csv_title, &$csv,&$i,&$course_id,&$user_id,&$field){
    
        if( strpos($field, 'user_field1') === false &&  strpos($field, 'user_field2') === false)//if another field please include it here like this     if( strpos($field, 'user_field1') === false &&  strpos($field, 'user_field2') === false   &&  strpos($field, 'user_field3') === false)
            return;
        
        if($field == 'user_field4'){
     
         $title=__('Name','vibe');
    
          if(!in_array($title,$csv_title))
            $csv_title[$i]=$title;
    
          $ifield = '4';
    
          if(bp_is_active('xprofile'))
           $field_val= bp_get_profile_field_data( 'field='.$ifield.'&user_id=' .$user_id );
                      
          if(isset($field_val) && $field_val)
            $csv[$i][]= $field_val;
          else
            $csv[$i][]= 'N.A';
            return;
         }
    
         if($field == 'user_field1'){
       
             $title=__('Code','vibe');
    
          if(!in_array($title,$csv_title))
            $csv_title[$i]=$title;
          $ifield = '1';  
          if(bp_is_active('xprofile'))
           $field_val= bp_get_profile_field_data( 'field='.$ifield.'&user_id=' .$user_id );
                      
          if(isset($field_val) && $field_val)
            $csv[$i][]= $field_val;
          else
            $csv[$i][]= 'N.A';
            return;
         }
               
         if($field == 'user_field10'){
       
             $title=__('Degree','vibe');
    
          if(!in_array($title,$csv_title))
            $csv_title[$i]=$title;
          $ifield = '10';  
          if(bp_is_active('xprofile'))
           $field_val= bp_get_profile_field_data( 'field='.$ifield.'&user_id=' .$user_id );
                      
          if(isset($field_val) && $field_val)
            $csv[$i][]= $field_val;
          else
            $csv[$i][]= 'N.A';
            return;
         }
               
                if($field == 'user_field11'){
       
             $title=__('Unit','vibe');
    
          if(!in_array($title,$csv_title))
            $csv_title[$i]=$title;
          $ifield = '11';  
          if(bp_is_active('xprofile'))
           $field_val= bp_get_profile_field_data( 'field='.$ifield.'&user_id=' .$user_id );
                      
          if(isset($field_val) && $field_val)
            $csv[$i][]= $field_val;
          else
            $csv[$i][]= 'N.A';
            return;
         }
    
             if($field == 'user_field13'){
       
             $title=__('Title','vibe');
    
          if(!in_array($title,$csv_title))
            $csv_title[$i]=$title;
          $ifield = '13';  
          if(bp_is_active('xprofile'))
           $field_val= bp_get_profile_field_data( 'field='.$ifield.'&user_id=' .$user_id );
                      
          if(isset($field_val) && $field_val)
            $csv[$i][]= $field_val;
          else
            $csv[$i][]= 'N.A';
            return;
         }
            
               
                if($field == 'user_field15'){
       
             $title=__('Manager Number','vibe');
    
          if(!in_array($title,$csv_title))
            $csv_title[$i]=$title;
          $ifield = '15';  
          if(bp_is_active('xprofile'))
           $field_val= bp_get_profile_field_data( 'field='.$ifield.'&user_id=' .$user_id );
                      
          if(isset($field_val) && $field_val)
            $csv[$i][]= $field_val;
          else
            $csv[$i][]= 'N.A';
            return;
         }
               
               
                if($field == 'user_field16'){
       
             $title=__('Manager Name','vibe');
    
          if(!in_array($title,$csv_title))
            $csv_title[$i]=$title;
          $ifield = '16';  
          if(bp_is_active('xprofile'))
           $field_val= bp_get_profile_field_data( 'field='.$ifield.'&user_id=' .$user_id );
                      
          if(isset($field_val) && $field_val)
            $csv[$i][]= $field_val;
          else
            $csv[$i][]= 'N.A';
            return;
         }
               
               
                if($field == 'user_field18'){
       
             $title=__('Job Name','vibe');
    
          if(!in_array($title,$csv_title))
            $csv_title[$i]=$title;
          $ifield = '18';  
          if(bp_is_active('xprofile'))
           $field_val= bp_get_profile_field_data( 'field='.$ifield.'&user_id=' .$user_id );
                      
          if(isset($field_val) && $field_val)
            $csv[$i][]= $field_val;
          else
            $csv[$i][]= 'N.A';
            return;
         }
               
             
    
        } // END public function __construct
    
        } // END class WPLMS_Customizer_Class
    } // END if(!class_exists('WPLMS_Customizer_Class'))
    
    ?>
    
    Thank you again. Best regards, George
    #301234
    JMG-Solutions_828
    Participant
    This reply has been marked as private.
    #301331
    JMG-Solutions_828
    Participant
    Hello, Also when I download the report the Arabic is coming in stranger language. Thanks
    #301466
    Anshuman Sahu
    Keymaster
    This reply has been marked as private.
    #310765
    JMG-Solutions_828
    Participant
    This reply has been marked as private.
    #311015
    Veronica
    Moderator
    This reply has been marked as private.
    #311276
    JMG-Solutions_828
    Participant
    This reply has been marked as private.
    #311686
    Veronica
    Moderator
    This reply has been marked as private.
    #314136
    JMG-Solutions_828
    Participant
    This reply has been marked as private.
    #314575
    Veronica
    Moderator
    This reply has been marked as private.
    #314610
    JMG-Solutions_828
    Participant
    This reply has been marked as private.
    #314802
    Veronica
    Moderator
    hi, as I have mentioned your theme is on version 4 but the plugins are on version 3 site is not configured properly and also pdf certificate version is very old the theme version is version4! and plugins are not on version4! please complete the setup first http://prntscr.com/upvm5g this is the main part to activate the version 4 for that you need to disbale the plugins as shown in the notice and activate the plugins which are necessary for version 4 that is vibebp and wplms plugin no more need to activate the plugins which are shown in the notice please check this if installing fresh wplms4:https://www.youtube.com/watch?v=KTT2a-L3F8o if you are updating the theme then follow: https://www.youtube.com/watch?v=Q_x-HOMItL8 please make sure that you have followed the tip properly NOTE: we never suggest any user go for such a big update on the running site with live users
Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Add custom user field in Administration Download Reports course stats’ is closed to new replies.