Home › Forums › Legacy Support › 4.0 Bugs & Issues › need help in statistics
- This topic has 7 replies, 2 voices, and was last updated 3 years, 4 months ago by Veronica.
Viewing 8 posts - 1 through 8 (of 8 total)
-
AuthorPosts
-
July 11, 2021 at 5:41 pm #364728EduMEE2Participanti 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.July 12, 2021 at 1:49 pm #364803VeronicaModeratorhi 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'; } }
July 12, 2021 at 5:54 pm #364852EduMEE2ParticipantThis reply has been marked as private.July 12, 2021 at 6:19 pm #364857EduMEE2ParticipantThis reply has been marked as private.July 12, 2021 at 6:51 pm #364858EduMEE2ParticipantThis reply has been marked as private.July 13, 2021 at 8:20 am #364888VeronicaModeratortry 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'; } }
July 13, 2021 at 1:44 pm #364974EduMEE2Participantit worked thanks. close this topicJuly 14, 2021 at 7:07 am #365033VeronicaModeratorgood to know -
AuthorPosts
Viewing 8 posts - 1 through 8 (of 8 total)
- The topic ‘need help in statistics’ is closed to new replies.