} else { $message = __('You do not have required permissions for this action.', 'tc'); } } } if (isset($_GET['page_num'])) { $page_num = (int) $_GET['page_num']; } else { $page_num = 1; } if (isset($_GET['s'])) { $api_keys_search = $_GET['s']; } else { $api_keys_search = ''; } $wp_api_keys_search = new TC_API_Keys_Search($api_keys_search, $page_num); $fields = $api_keys->get_api_keys_fields(); $columns = $api_keys->get_columns(); ?> <div class="wrap tc_wrap"> <h2><?php if (isset($_GET['action']) && $_GET['action'] == 'edit') { ?> <a href="edit.php?post_type=tc_events&page=<?php echo $_GET['page'] . '&tab=' . $_GET['tab']; ?> " class="add-new-h2"><?php _e('Add New', 'tc'); ?> </a><?php }
</tbody> </table> <?php global $current_user; get_currentuserinfo(); $current_user_name = $current_user->user_login; $staff_api_keys_num = 0; $has_api_records = false; if (current_user_can('manage_options')) { $wp_api_keys_search_all = new TC_API_Keys_Search('', '', 'all'); if (count($wp_api_keys_search_all->get_results()) > 0) { $has_api_records = true; } } $wp_api_keys_search = new TC_API_Keys_Search('', '', $ticket_event_id); if (count($wp_api_keys_search->get_results()) > 0) { $has_api_records = true; } if (!current_user_can('manage_options')) { foreach ($wp_api_keys_search->get_results() as $api_key) { $api_key_obj = new TC_API_Key($api_key->ID); if ($api_key_obj->details->api_username == $current_user_name) { $staff_api_keys_num++; } } } if ($has_api_records && (current_user_can('manage_options') || !current_user_can('manage_options') && $staff_api_keys_num > 0)) { ?> <form action="" method="post" enctype="multipart/form-data"> <table class="checkin-table">
_e("There are no any check-ins for this ticket yet."); ?> </td> </tr> <?php } ?> </tbody> </table> <?php global $current_user; get_currentuserinfo(); $current_user_name = $current_user->user_login; $staff_api_keys_num = 0; $wp_api_keys_search = new TC_API_Keys_Search('', '', $ticket_event_id); if (!current_user_can('manage_options')) { foreach ($wp_api_keys_search->get_results() as $api_key) { $api_key_obj = new TC_API_Key($api_key->ID); if ($api_key_obj->details->api_username == $current_user_name) { $staff_api_keys_num++; } } } if (count($wp_api_keys_search->get_results()) > 0 && (current_user_can('manage_options') || !current_user_can('manage_options') && $staff_api_keys_num > 0)) { ?> <form action="" method="post" enctype="multipart/form-data"> <table class="checkin-table"> <tbody> <tr valign="top"> <th scope="row"><label for="api_key"><?php
function save_metabox_values($post_id) { if (get_post_type($post_id) == 'tc_events') { $metas = array(); $metas['event_presentation_page'] = $post_id; //Event calendar support URL for better events interface if (isset($_POST['show_tickets_automatically'])) { update_post_meta($post_id, 'show_tickets_automatically', true); } else { update_post_meta($post_id, 'show_tickets_automatically', false); } foreach ($_POST as $field_name => $field_value) { if (preg_match('/_post_meta/', $field_name)) { $metas[str_replace('_post_meta', '', $field_name)] = $field_value; } $metas = apply_filters('events_metas', $metas); if (isset($metas)) { foreach ($metas as $key => $value) { update_post_meta($post_id, $key, $value); } } } //Create default API Key for this event if doesn't exists if (apply_filters('tc_create_event_api_key_automatically', true) == true) { if (!empty($_POST['post_title'])) { $wp_api_keys_search = new TC_API_Keys_Search('', '', $post_id); if (count($wp_api_keys_search->get_results()) == 0) { $api_key_post = array('post_content' => '', 'post_status' => 'publish', 'post_title' => __('', 'tc'), 'post_type' => 'tc_api_keys'); $api_key_post = apply_filters('tc_event_api_key_post', $api_key_post); $api_key_post_id = wp_insert_post($api_key_post); /* Add post metas for the API Key */ $api_keys = new TC_API_Keys(); if ($api_key_post_id != 0) { update_post_meta($api_key_post_id, 'event_name', $post_id); update_post_meta($api_key_post_id, 'api_key_name', $_POST['post_title']); update_post_meta($api_key_post_id, 'api_key', $api_keys->get_rand_api_key()); update_post_meta($api_key_post_id, 'api_username', ''); } } } } } }