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

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

62 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
6 global $wpscfunction;
7
8 $ticket_notes_history_with_logs = '';
9
10 $threads = get_posts(array(
11 'post_type' => 'wpsc_ticket_thread',
12 'post_status' => 'publish',
13 'posts_per_page' => -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('note','log'),
26 'compare' => 'IN'
27 ),
28 ),
29 ));
30
31 $auth_id = $wpscfunction->get_ticket_fields($ticket_id,'ticket_auth_code');
32
33 if($threads){
34 $tags = array("<strong>", "</strong>");
35 foreach ($threads as $thread) {
36 $thread_type = get_post_meta( $thread->ID,'thread_type',true);
37 $user_name = get_post_meta($thread->ID,'customer_name',true);
38 if(get_post_meta($thread->ID, 'thread_type',true) == 'log'){
39 $thread_type = '(log)';
40 }else{
41 $thread_type ='(' . $thread_type .')';
42 }
43
44 $attachments = get_post_meta($thread->ID, 'attachments', true);
45
46 $ticket_notes_history_with_logs .= '<hr><strong>'.$user_name.'</strong> <small><i>'.$wpscfunction->time_elapsed_timestamp($thread->post_date_gmt).'</i> ' . $thread_type . ' </small><br>'.$thread->post_content;
47
48 if($attachments){
49 $ticket_notes_history_with_logs .= 'Attachments :';
50 foreach( $attachments as $attachment ):
51 $attach = array();
52 $attach_meta = get_term_meta($attachment);
53 foreach ($attach_meta as $key => $value) {
54 $attach[$key] = $value[0];
55 }
56 $download_url = home_url('/').'?wpsc_attachment='.$attachment.'&tid='.$ticket_id.'&tac='.$auth_id;
57 $ticket_notes_history_with_logs.= '<br><a style="text-decoration:none;" href="'.$download_url.'" target="_blank">'.$attach['filename'].'</a>';
58 endforeach;
59 }
60 }
61 }
62