</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 _e('API Key'); ?>
?> " scope="col"><?php echo $col; ?> </th> <?php $n++; } ?> </tr> </thead> <tbody> <?php $style = ''; foreach ($wp_api_keys_search->get_results() as $api_key) { $api_key_obj = new TC_API_Key($api_key->ID); $api_key_object = apply_filters('tc_api_key_object_details', $api_key_obj->details); $style = ' class="alternate"' == $style ? '' : ' class="alternate"'; ?> <tr id='user-<?php echo $api_key_object->ID; ?> ' <?php echo $style; ?> > <?php $n = 1; foreach ($columns as $key => $col) { if ($key == 'edit') {
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', ''); } } } } } }