need help in statistics

Home Forums Legacy Support 4.0 Bugs & Issues need help in statistics

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #364728
    EduMEE2
    Participant
    i have a buddypress custom field: passport id i want when instructor is importing course statistics then this passport id should be mentioned in the course statistcs exported file. thanks.
    #364803
    Veronica
    Moderator
    hi this code will help you:
    
    add_action('wplms_course_stats_process','process_custom_course_stat',10,8);
    add_filter('wplms_course_stats_list','add_custom_course_stat');
    
     function add_custom_course_stat($list){
       $new_list = array(
                        'user_field1'=>'Location',
                        'nome'=>'Nome'
                        <strong>//add another element like same above 'user_field3'=>'Gender'</strong>
                         );
       
       $list=array_merge($list,$new_list);
        return $list;
    }
              
    function process_custom_course_stat(&$csv_title, &$csv,&$i,&$course_id,&$user_id,&$field,&$ccsv,&$k){
      if($field != 'nome') // Ensures the field was checked.
         return;
    
        $title=__('Nome','wplms');
    	if(!in_array($title,$csv_title))
    	 $csv_title[$k]=array('title'=>$title,'field'=>'nome');
    		$ifield = 'Nome'; 
      	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;
    	      	$ccsv[$i]['nome'] =  $field_val;
    	   
        }else{
    
          $csv[$i][]= 'NA';
          $ccsv[$i]['nome'] = 'NA';
        }
    	
    
     }
    #364852
    EduMEE2
    Participant
    This reply has been marked as private.
    #364857
    EduMEE2
    Participant
    This reply has been marked as private.
    #364858
    EduMEE2
    Participant
    This reply has been marked as private.
    #364888
    Veronica
    Moderator
    try to use exactly this one:
    
    add_action('wplms_course_stats_process','process_custom_course_stat',10,8);
    add_filter('wplms_course_stats_list','add_custom_course_stat');
    
     function add_custom_course_stat($list){
       $new_list = array(
                        'Identity Number'=>'Identity Number'
                         );
       
       $list=array_merge($list,$new_list);
        return $list;
    }
              
    function process_custom_course_stat(&$csv_title, &$csv,&$i,&$course_id,&$user_id,&$field,&$ccsv,&$k){
      if($field != 'Identity Number') // Ensures the field was checked.
         return;
    
        $title=__('Identity Number','wplms');
        if(!in_array($title,$csv_title))
         $csv_title[$k]=array('title'=>$title,'field'=>'Identity Number');
            $ifield = 'Identity Number'; 
        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;
                $ccsv[$i]['Identity Number'] =  $field_val;
           
        }else{
    
          $csv[$i][]= 'NA';
          $ccsv[$i]['Identity Number'] = 'NA';
        }
        
    
     }
    #364974
    EduMEE2
    Participant
    it worked thanks. close this topic
    #365033
    Veronica
    Moderator
    good to know
Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘need help in statistics’ is closed to new replies.