PluginProbe
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent / 2.3.1
SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent v2.3.1
3.5.4 3.5.3 3.5.2 3.5.1 3.4.9 3.5.0 3.4.8 3.4.7 trunk 2.3.1 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6
supportcandy / includes / functions / get_ticket_history.php

get_ticket_history.php in SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent 2.3.1, at includes/functions/get_ticket_history.php

61 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly
4 }
5 global $wpscfunction;
6 $wpsc_thread_limit = get_option('wpsc_thread_limit');
7
8 $ticket_history = '';
9
10 $threads = get_posts(array(
11 'post_type' => 'wpsc_ticket_thread',
12 'post_status' => 'publish',
13 'posts_per_page' => $wpsc_thread_limit+1,
14 'orderby' => 'date',
15 'order' => 'DESC',
16 'meta_query' => array(
17 'relation' => 'AND',
18 array(
19 'key' => 'ticket_id',
20 'value' => $ticket_id,
21 'compare' => '='
22 ),
23 array(
24 'key' => 'thread_type',
25 'value' => array('reply','report'),
26 'compare' => 'IN'
27 ),
28 ),
29 ));
30
31
32 $auth_id = $wpscfunction->get_ticket_fields($ticket_id, 'ticket_auth_code');
33
34 if($threads){
35 $cntr = 0;
36 foreach ($threads as $thread) {
37 if($cntr==0){
38 $cntr ++;
39 continue;
40 }
41 $user_name = get_post_meta($thread->ID,'customer_name',true);
42 $attachments = get_post_meta($thread->ID, 'attachments', true);
43 $thread_type = get_post_meta($thread->ID, 'thread_type',true);
44 $thread_type = '(' . $thread_type .')';
45
46 $ticket_history .= '<hr><strong>'.$user_name.'</strong> <small><i>'.$wpscfunction->time_elapsed_timestamp($thread->post_date_gmt).'</i>' . $thread_type . '</small><br>'.$thread->post_content;
47 if($attachments){
48 $ticket_history .= 'Attachments :';
49 foreach( $attachments as $attachment ):
50 $attach = array();
51 $attach_meta = get_term_meta($attachment);
52 foreach ($attach_meta as $key => $value) {
53 $attach[$key] = $value[0];
54 }
55 $download_url = home_url('/').'?wpsc_attachment='.$attachment.'&tid='.$ticket_id.'&tac='.$auth_id;
56 $ticket_history.= '<br><a style="text-decoration:none;" href="'.$download_url.'" target="_blank">'.$attach['filename'].'</a>';
57 endforeach;
58 }
59 }
60 }
61