0. Install WPLMS customiser plugin.
1. Go to WP Admin -> Plugins ->Editor -> Wplms customizer -> customizer_class.php
2. Add this code in __construct function :
Assuming the custom user field is Location :
add_filter('wplms_course_stats_list',array($this,'add_custom_course_stat')); add_action('wplms_course_stats_process',array($this,'process_custom_course_stat'),10,6);
3. Add this code in the class :
function add_custom_course_stat($list){ $list['user_field']= 'Location'; return $list; } function process_custom_course_stat(&$csv_title, &$csv,&$i,&$course_id,&$user_id,&$field){ if($field != 'user_field') // Ensures the field was checked. return; $title=__('Location','vibe'); if(!in_array($title,$csv_title)) $csv_title[$i]=$title; $ifield = 'Location'; 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'; }
Github gist : https://gist.github.com/MrVibe/c0ea6131147072b61dfa