Tribe__Tickets__Admin__Ticket_History::supply_history()
Responds to ajax requests to access the ticket history.
Source
File: src/Tribe/Admin/Ticket_History.php
public function supply_history() {
if ( ! wp_verify_nonce( @$_POST[ 'check' ], 'view-ticket-history-' . @$_POST[ 'ticket_id' ] ) ) {
return;
}
$html = '<table>';
$history = Tribe__Post_History::load( $_POST[ 'ticket_id' ] );
foreach ( $history->get_entries() as $entry ) {
$html .= '<tr> <td>' . esc_html( $entry->datetime ) . '</td> <td>' . $entry->message . '</td> </tr>';
}
$html .= '</table>';
if ( ! $history->has_entries() ) {
$html = '<p>' . esc_html__( 'No history available', 'event-tickets' ) . '</p>';
}
wp_send_json_success( array(
'html' => $html,
) );
}