강의 보고서에서 이름 변경하기

강의 보고서 내보내기 시 이름 에서 사용자 이름이 아닌 아이디 가 출력이 될경우가 있습니다. 이는 사용자의 공개적으로 표시할 이름 에서 선택된 값으로 정해집니다. 무조건 사용자 이름으로 출력되도록 하기 위해서는  /wp-content/themes/edumaster/functions.php 파일에서 아래 내용을 추가해 주시면 됩니다.
//강의 보고서 사용자 아이디 를 사용자 이름 으로 변경
function learndash_custom_reports_report_column_item( $column_value, $column_key, $report_item, $report_user ){
       if( $column_key == 'user_name' ) {
              if ( $report_user instanceof WP_User ) {
                     $first =  $report_user->user_firstname;
                     $last = $report_user->last_name;
                     if( !empty($last) ){
                            $column_value = $last;
                     }

                     if( !empty($first) ){
                            if( !empty($last) ){
                                   $column_value .= ' ';
                            }else{
                                   $column_value = '';
                            }
                            $column_value .= $first;
                     }

              }
       }
       return $column_value;
}
add_filter('learndash_report_column_item', 'learndash_custom_reports_report_column_item', 10 , 4);

Code language: PHP (php)
  성 필드 는 사용하지 않는경우는 아래 내용으로 추가 하시기 바랍니다.
//강의 보고서 사용자 아이디 를 사용자 이름 으로 변경
function learndash_custom_reports_report_column_item( $column_value, $column_key, $report_item, $report_user ){
       if( $column_key == 'user_name' ) {
              if ( $report_user instanceof WP_User ) {
                     $first =  $report_user->user_firstname;

                     if( !empty($first) ){
                            $column_value = $first;
                     }
              }
       }
       return $column_value;
}
add_filter('learndash_report_column_item', 'learndash_custom_reports_report_column_item', 10 , 4);

Code language: PHP (php)