mage-eventpress/inc/template-prts/total_seat.php

33 lines
1.8 KiB
PHP
Raw Normal View History

2020-05-24 04:17:41 -04:00
<?php
if (!defined('ABSPATH')) {
2020-07-12 06:42:13 -04:00
die;
2020-05-24 04:17:41 -04:00
} // Cannot access pages directly.
add_action('mep_event_seat', 'mep_ev_seat');
if (!function_exists('mep_ev_seat')) {
function mep_ev_seat()
{
2020-07-12 06:42:13 -04:00
global $post;
2021-09-20 01:52:52 -04:00
$event_id = mep_get_default_lang_event_id(get_the_id());
$event_meta = get_post_custom($event_id);
$recurring = get_post_meta($event_id, 'mep_enable_recurring', true) ? get_post_meta($event_id, 'mep_enable_recurring', true) : 'no';
2020-05-24 04:17:41 -04:00
ob_start();
if ($recurring == 'no') {
2021-09-20 01:52:52 -04:00
$mep_event_ticket_type = get_post_meta($event_id, 'mep_event_ticket_type', true) ? get_post_meta($event_id, 'mep_event_ticket_type', true) : array();
$event_date = get_post_meta($event_id, 'event_start_date', true) ? get_post_meta($event_id, 'event_start_date', true) : '';
2020-05-24 04:17:41 -04:00
$mep_available_seat = array_key_exists('mep_available_seat', $event_meta) ? $event_meta['mep_available_seat'][0] : 'on';
if (is_array($mep_event_ticket_type) && sizeof($mep_event_ticket_type) > 0) {
2022-11-07 02:05:59 -05:00
$upcoming_date = '';
2021-09-20 01:52:52 -04:00
$total_seat = apply_filters('mep_event_total_seat_counts', mep_event_total_seat($event_id, 'total'), $event_id);
$total_resv = apply_filters('mep_event_total_resv_seat_count', mep_event_total_seat($event_id, 'resv'), $event_id);
2022-11-07 02:05:59 -05:00
// $total_sold = mep_ticket_type_sold($event_id);
2022-10-31 22:09:15 -04:00
$total_sold = mep_get_event_total_seat_left($event_id, $upcoming_date);
2022-11-07 02:05:59 -05:00
$total_left = (int) $total_seat - ((int) $total_sold + (int) $total_resv);
2022-10-31 22:09:15 -04:00
// $total_seat = apply_filters('mep_event_total_seat_count', $_total_left, $event_id,'',$event_date);
2020-07-12 06:42:13 -04:00
require(mep_template_file_path('single/total_seat.php'));
2020-05-24 04:17:41 -04:00
}
}
$content = ob_get_clean();
2021-09-20 01:52:52 -04:00
echo apply_filters('mage_event_single_total_seat', $content, $event_id);
2020-05-24 04:17:41 -04:00
}
2021-09-20 01:52:52 -04:00
}