| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
global $current_user, $wppmfunction ,$wpdb; |
| 6 |
$task_id = isset($_POST['id']) ? absint(sanitize_text_field(wp_unslash($_POST['id']))) : 0 ; |
| 7 |
$is_archived = (isset($_POST['is_archived']) && absint(sanitize_text_field(wp_unslash($_POST['is_archived']))) == 1) ? 0 : 1 ; |
| 8 |
if (!(($current_user->ID && $current_user->has_cap('manage_options')) || $wppmfunction->has_permission('change_task_details',$task_id))) {exit;} |
| 9 |
$values=array( |
| 10 |
'is_archived'=>esc_sql($is_archived) |
| 11 |
); |
| 12 |
$wpdb->update($wpdb->prefix.'wppm_task', $values, array('id'=>esc_sql($task_id))); |