<?php 

function delete_from_sms_list($args) {
	$option = get_option("sms_list");
	unset($option[$args['name']]);
	update_option("sms_list", $option);
	return ['status' => true, 'msg' => 'Congratulations, you have successfully deactivated the post. '.$args['name']];
}

function delete_support_ticket($args) {
	$post = new post;
	$comments = $post->get_post_by_meta_data(['type' => 'comment', 'obj' => $args['id']]);
	if(_count($comments) && is_array($comments)) {
		foreach ($comments as $key => $value) {
			$post->drop_post($value['id']);
		}
	}
	$post->drop_post($args['id']);
	return ["status" => true, "msg" => "You have successfully deleted the support ticket."];
}

function msg_close_ticket($args) {
	$post = new post;
	$ticket_meta = $post->update_post_meta($args['id'], ['status' => 'inactive']);
	return ["status" => true, "msg" => "You have successfully closed the support ticket."];
}

function msg_open_ticket($args) {
	$post = new post;
	$ticket_meta = $post->update_post_meta($args['id'], ['status' => 'active']);
	return ["status" => true, "msg" => "You have successfully re-opened the support ticket."];
}