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_notes_history.php

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

56 lines 1.7 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
6 global $wpscfunction;
7 $ticket_notes_history = '';
8
9 $threads = get_posts(array(
10 'post_type' => 'wpsc_ticket_thread',
11 'post_status' => 'publish',
12 'posts_per_page' => -1,
13 'orderby' => 'date',
14 'order' => 'DESC',
15 'meta_query' => array(
16 'relation' => 'AND',
17 array(
18 'key' => 'ticket_id',
19 'value' => $ticket_id,
20 'compare' => '='
21 ),
22 array(
23 'key' => 'thread_type',
24 'value' => 'note',
25 'compare' => 'IN'
26 ),
27 ),
28 ));
29
30
31 $auth_id = $wpscfunction->get_ticket_fields($ticket_id,'ticket_auth_code');
32
33 if($threads){
34 foreach ($threads as $thread) {
35 $user_name = get_post_meta($thread->ID,'customer_name',true);
36 $attachments = get_post_meta($thread->ID, 'attachments', true);
37 $thread_type = get_post_meta($thread->ID, 'thread_type',true);
38 $thread_type = '(private note)';
39
40 $ticket_notes_history .= '<hr><strong>'.$user_name.'</strong> <small><i>'.$wpscfunction->time_elapsed_timestamp($thread->post_date_gmt).'</i>' . $thread_type. '</small><br>'.$thread->post_content;
41
42 if($attachments){
43 $ticket_notes_history .= 'Attachments :';
44 foreach( $attachments as $attachment ):
45 $attach = array();
46 $attach_meta = get_term_meta($attachment);
47 foreach ($attach_meta as $key => $value) {
48 $attach[$key] = $value[0];
49 }
50 $download_url = home_url('/').'?wpsc_attachment='.$attachment.'&tid='.$ticket_id.'&tac='.$auth_id;
51 $ticket_notes_history.= '<br><a style="text-decoration:none;" href="'.$download_url.'" target="_blank">'.$attach['filename'].'</a>';
52 endforeach;
53 }
54 }
55 }
56