# supportcandy/2.3.1/includes/admin/settings/set_ticket_widgets.php

SupportCandy – AI Customer Support Ticket System &amp; Live Chatbot Agent, version 2.3.1. 22 lines.

- Page: https://pluginprobe.com/plugins/supportcandy/2.3.1/code/includes/admin/settings/set_ticket_widgets.php
- Raw: https://pluginprobe.com/plugins/supportcandy/2.3.1/raw/includes/admin/settings/set_ticket_widgets.php
- Modified: 2022-07-21T08:20:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/supportcandy/2.3.1/code/includes/admin/settings/set_ticket_widgets.php#L10-L20`.

```php
<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

global $current_user, $wpscfunction;

if (
	check_ajax_referer('set_ticket_widgets', '_ajax_nonce', false) != 1
) wp_send_json_error('Unauthorised request!', 400);

if (!($current_user->ID && $current_user->has_cap('manage_options'))) {
	exit;
}

$ticket_widget_id = isset($_POST) && isset($_POST['ticket_widget_ids']) ? $wpscfunction->sanitize_array($_POST['ticket_widget_ids']) : array();

foreach ($ticket_widget_id as $key => $ticket_widget_ids) {
	update_term_meta(intval($ticket_widget_ids), 'wpsc_ticket_widget_load_order', intval($key));
}

echo '{ "sucess_status":"1","messege":"'.__('Ticket Widget Order  saved.','supportcandy').'" }';
```
