| @@ -1,17 +1,17 @@ | ||
| 1 | -<?php | |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | - exit; // Exit if accessed directly | |
| 4 | -} | |
| 5 | - | |
| 6 | -global $current_user,$wpdb; | |
| 7 | -if (!($current_user->ID && $current_user->has_cap('manage_options')|| ($current_user->ID && $current_user->has_cap('wppm_admin')))) {exit;} | |
| 8 | -if ( check_ajax_referer( 'wppm_delete_category', '_ajax_nonce', false ) != 1 ) { | |
| 9 | - wp_send_json_error( 'Unauthorised request!', 401 ); | |
| 10 | -} | |
| 11 | -$cat_id = isset($_POST) && isset($_POST['cat_id']) ? absint(sanitize_text_field(wp_unslash($_POST['cat_id']))) : 0; | |
| 12 | -$cat_id = absint($cat_id); | |
| 13 | -if (!$cat_id) {exit;} | |
| 14 | - | |
| 15 | -$wpdb->delete($wpdb->prefix.'wppm_project_categories', array( 'id' => absint($cat_id))); | |
| 16 | - | |
| 17 | - | |
| 1 | +<?php | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; // Exit if accessed directly | |
| 4 | +} | |
| 5 | + | |
| 6 | +global $current_user,$wpdb; | |
| 7 | +if (!($current_user->ID && $current_user->has_cap('manage_options')|| ($current_user->ID && $current_user->has_cap('wppm_admin')))) {exit;} | |
| 8 | +if ( check_ajax_referer( 'wppm_delete_category', '_ajax_nonce', false ) != 1 ) { | |
| 9 | + wp_send_json_error( 'Unauthorised request!', 401 ); | |
| 10 | +} | |
| 11 | +$cat_id = isset($_POST) && isset($_POST['cat_id']) ? absint(sanitize_text_field(wp_unslash($_POST['cat_id']))) : 0; | |
| 12 | +$cat_id = absint($cat_id); | |
| 13 | +if (!$cat_id) {exit;} | |
| 14 | + | |
| 15 | +$wpdb->delete($wpdb->prefix.'wppm_project_categories', array( 'id' => absint($cat_id))); | |
| 16 | + | |
| 17 | + | |