beaphoenix
New member
Hi guys,
I leave here a code and the code image. What i need. If a user buy something from my website, his username it will be shown in a table. But i want to change this, and i want in the table to be shown the First and last name, not the username. Please help me. Thank you!
I leave here a code and the code image. What i need. If a user buy something from my website, his username it will be shown in a table. But i want to change this, and i want in the table to be shown the First and last name, not the username. Please help me. Thank you!
Code:
<table>
<thead>
<tr>
<th><?php _e('Date', 'wc-lottery-pn') ?></th>
<th><?php _e('Prenume', 'wc-lottery-pn') ?></th>
<th><?php _e('Nume', 'wc-lottery-pn') ?></th>
<?php if ($use_ticket_numbers === 'yes' ) :?>
<th><?php _e('Ticket number', 'wc-lottery-pn') ?></th>
<?php endif; ?>
<?php if ($use_answers === true && 'yes' === get_option('lottery_answers_in_history', 'yes') && ( 'no' === get_option('lottery_answers_in_history_finished', 'no') || $product->is_closed() === TRUE ) ) :?>
<th><?php _e('Answer', 'wc-lottery-pn') ?></th>
<?php endif; ?>
</tr>
</thead>
<?php
$lottery_history = $product->lottery_history();
if( $lottery_history ) {
foreach ($lottery_history as $history_value) {
echo "<tr>";
echo "<td class='date'>".date_i18n( $date_format, strtotime( $history_value->date )).' '.date_i18n( $time_format, strtotime( $history_value->date ))."</td>";
echo $history_value->userid ? "<td class='username'>". ( get_userdata($history_value->userid) ? get_userdata($history_value->userid)->display_name : '' ) ."</td>" : '';
echo $history_value->userid ? "<td class=''>". ( get_userdata($history_value->userid) ? get_userdata($history_value->userid)->display_name : '' ) ."</td>" : '';
if ($use_ticket_numbers === 'yes' ) {
echo "<td class='ticket_number'>" . apply_filters( 'ticket_number_display_html' , $history_value->ticket_number, $product ) . "</td>";
}
if ( $use_answers === true && 'yes' === get_option('lottery_answers_in_history', 'yes') && ( 'no' === get_option('lottery_answers_in_history_finished', 'no') || $product->is_closed() === TRUE ) ){
$answer = isset( $answers[$history_value->answer_id] ) ? $answers[$history_value->answer_id] : false;