Example #1
0
<?php 
if ('open' == $status) {
    if (current_user_can('reply_ticket')) {
        require WPAS_PATH . 'includes/admin/metaboxes/replies-form.php';
    } else {
        ?>

		<p><?php 
        _e('Sorry, you don\'t have sufficient permissions to reply to tickets.', 'awesome-support');
        ?>
</p>

	<?php 
    }
    /* The ticket was closed */
} elseif ('closed' == $status) {
    ?>

	<div class="updated below-h2" style="margin-top: 2em;">
		<h2 style="margin: 0.5em 0; padding: 0; line-height: 100%;"><?php 
    _e('Ticket is closed', 'wpas');
    ?>
</h2>
		<p><?php 
    printf(__('This ticket has been closed. If you want to write a new reply to this ticket, you need to <a href="%s">re-open it first</a>.', 'awesome-support'), wpas_get_open_ticket_url($post->ID));
    ?>
</p>
	</div>

<?php 
}
Example #2
0
 /**
  * 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;
 }
function wpas_get_close_ticket_url($ticket_id)
{
    return wpas_get_open_ticket_url($ticket_id, 'close');
}
Example #4
0
 * @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');