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 / admin / email_notifications / clone_ticket_notification.php

clone_ticket_notification.php in SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent 2.3.1, at includes/admin/email_notifications/clone_ticket_notification.php

50 lines 1.6 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 $current_user, $wpscfunction;
7
8 if (
9 check_ajax_referer('clone_ticket_notification', '_ajax_nonce', false) != 1
10 ) wp_send_json_error('Unauthorised request!', 400);
11
12 if (!($current_user->ID && $current_user->has_cap('manage_options'))) {
13 exit;
14 }
15
16 $term_id = isset($_POST) && isset($_POST['term_id']) ? intval($_POST['term_id']) : 0;
17 if(!$term_id) die();
18
19 $source_term = get_term_by('id',$term_id,'wpsc_en');
20
21 // Title
22 $title = $source_term->name.' clone';
23 $term = wp_insert_term( $title, 'wpsc_en' );
24 if($term && isset($term['term_id'])){
25
26 $type = get_term_meta($term_id,'type',true);
27 add_term_meta ($term['term_id'], 'type', $type);
28
29 $subject = get_term_meta($term_id,'subject',true);
30 add_term_meta ($term['term_id'], 'subject', $subject);
31
32 $body = get_term_meta($term_id,'body',true);
33 add_term_meta ($term['term_id'], 'body', $body);
34
35 $recipients = get_term_meta($term_id,'recipients',true);
36 add_term_meta ($term['term_id'], 'recipients', $recipients);
37
38 $extra_recipients = get_term_meta($term_id,'extra_recipients',true);
39 add_term_meta ($term['term_id'], 'extra_recipients', $extra_recipients);
40
41 $arr = get_term_meta($term_id,'conditions',true);
42 add_term_meta ($term['term_id'], 'conditions', $arr);
43
44 do_action('wpsc_clone_ticket_notification',$term,$source_term);
45 echo '{ "sucess_status":"1","messege":"'.__('Email Notification clone successfull.','supportcandy').'" }';
46
47 } else {
48 echo '{ "sucess_status":"0","messege":"'.__('An error occured while creating email notification.','supportcandy').'" }';
49 }
50