/** * Add items in action row. * * Add a quick option to open or close a ticket * directly from the tickets list. * * @since 3.0.0 * @param array $actions List of existing options * @param object $post Current post object * @return array List of options with ours added */ public function ticket_action_row($actions, $post) { if ('ticket' === $post->post_type) { $status = wpas_get_ticket_status($post->ID); if ('open' === $status) { $actions['close'] = '<a href="' . wpas_get_close_ticket_url($post->ID) . '">' . __('Close', 'awesome-support') . '</a>'; } elseif ('closed' === $status) { $actions['open'] = '<a href="' . wpas_get_open_ticket_url($post->ID) . '">' . __('Open', 'awesome-support') . '</a>'; } } return $actions; }
<?php if (current_user_can('close_ticket')) { ?> <button type="submit" name="wpas_do" class="button-secondary wpas_btn_reply_close" value="reply_close"><?php _e('Reply & Close', 'awesome-support'); ?> </button> <?php } /** * Fired after all the submission form buttons were output * * @since 3.2.6 * * @param int $post_id Ticket ID */ do_action('wpas_post_reply_buttons_after', $post->ID); // Link to close the ticket if ('open' === get_post_meta(get_the_ID(), '_wpas_status', true)) { ?> <a class="wpas_btn_close_bottom" href="<?php echo wpas_get_close_ticket_url($post->ID); ?> "><?php echo esc_html_x('Close', 'Close the ticket', 'awesome-support'); ?> </a> <?php } ?> </div>
* @since 3.0.0 */ // If this file is called directly, abort. if (!defined('WPINC')) { die; } global $pagenow, $post; /* Current status */ $ticket_status = get_post_meta(get_the_ID(), '_wpas_status', true); /** * Status action link * * @var string * @see admin/class-awesome-support-admin.php */ $action = in_array($ticket_status, array('closed', '')) ? wpas_get_open_ticket_url($post->ID) : wpas_get_close_ticket_url($post->ID); /** * Get available statuses. */ $statuses = wpas_get_post_status(); /* Get post status */ $post_status = isset($post) ? $post->post_status : ''; /* Get time */ if (isset($post)) { $date = human_time_diff(get_the_time('U', $post->ID), current_time('timestamp')); } ?> <div class="wpas-ticket-status submitbox"> <p> <strong><?php _e('Ticket status:', 'awesome-support');