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 / rest_api / v1 / delete_ticket.php

delete_ticket.php in SupportCandy – AI Customer Support Ticket System & Live Chatbot Agent 2.3.1, at includes/rest_api/v1/delete_ticket.php

45 lines 933 B
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
9 $params = $request->get_params();
10 $ticket_id = isset( $params['id'] ) ? $params['id'] : 0;
11
12 $response = array();
13
14 if ($wpscfunction->is_ticket($ticket_id)) {
15
16 if($wpscfunction->has_permission('delete_ticket',$ticket_id)){
17 $wpscfunction->delete_tickets($ticket_id);
18 $response = array(
19 'ticket_deleted',
20 'Ticket id '. $ticket_id .' is deleted successfully',
21 array(
22 'status' => 200,
23 )
24 );
25 }else{
26 $response = array(
27 'unauthorized',
28 'You do not have permission to delete this ticket.',
29 array(
30 'status' => 404,
31 )
32 );
33 }
34
35 } else {
36
37 $response = new WP_Error(
38 'not_found',
39 'Ticket not found for id '.$ticket_id,
40 array(
41 'status' => 404,
42 )
43 );
44
45 }