예제 #1
0
 function test_wpas_mark_reply_read()
 {
     $ticket_id = wpas_insert_ticket($this->ticket_data, false);
     $reply_id = wpas_insert_reply($this->reply_data, $ticket_id);
     $edited = wpas_mark_reply_read($reply_id);
     $this->assertInternalType('int', $edited);
 }
/**
 * Mark a ticket reply as read with Ajax
 *
 * @return void
 */
function wpas_mark_reply_read_ajax()
{
    $ID = wpas_mark_reply_read();
    if (false === $ID || is_wp_error($ID)) {
        $ID = $ID->get_error_message();
    }
    echo $ID;
    die;
}
예제 #3
0
 /**
  * Mark replies as read.
  *
  * When an agent replies to a ticket, we mark all previous replies
  * as read. We suppose it's all been read when the agent replies.
  * This allows for keeping replies unread until an agent replies
  * or manually marks the last reply as read.
  *
  * @since  3.0.0
  * @return void
  */
 public function mark_replies_read($reply_id, $data)
 {
     $replies = wpas_get_replies(intval($data['post_parent']), 'unread');
     foreach ($replies as $reply) {
         wpas_mark_reply_read($reply->ID);
     }
 }