Orders::get_event_link( int $event_id, bool $url_only = false )
Links to sales report for all tickets in Tickets Commerce for this event.
Contents
Parameters
- $event_id
-
(int) (Required)
- $url_only
-
(bool) (Optional)
Default value: false
Return
(string)
Source
File: src/Tickets/Commerce/Reports/Orders.php
public function get_event_link( $event_id, $url_only = false ) {
$ticket_ids = (array) tribe( Module::class )->get_tickets_ids( $event_id );
if ( empty( $ticket_ids ) ) {
return '';
}
$post = get_post( $event_id );
$query = [
'post_type' => $post->post_type,
'page' => static::$page_slug,
'post_id' => $event_id,
];
$report_url = add_query_arg( $query, admin_url( 'admin.php' ) );
/**
* Filter the Reports Events Orders Report URL.
*
* @since 5.2.0
*
* @var string $report_url Report URL
* @var int $event_id The post ID
* @var array $ticket_ids An array of ticket IDs
*
* @return string
*/
$report_url = apply_filters( 'tec_tickets_commerce_reports_orders_event_link', $report_url, $event_id, $ticket_ids );
return $url_only
? $report_url
: '<small> <a href="' . esc_url( $report_url ) . '">' . esc_html__( 'Sales report', 'event-tickets' ) . '</a> </small>';
}
Changelog
| Version | Description |
|---|---|
| 5.6.4 | - tec_tickets_filter_event_id filter to normalize the $post_id. |
| 5.2.0 | Introduced. |