← All changes
|
includes/admin/tasks/open_task/wppm_delete_task_thread.php
+36
-36
5.0.7
→
6.0.6
View file →
| @@ -1,37 +1,37 @@ | ||
| 1 | -<?php | |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | - exit; // Exit if accessed directly | |
| 4 | -} | |
| 5 | -global $wpdb,$wppmfunction,$current_user; | |
| 6 | -$task_id = isset($_POST['task_id']) ? absint(sanitize_text_field(wp_unslash($_POST['task_id']))) : '' ; | |
| 7 | -$proj_id = isset($_POST['proj_id']) ? absint(sanitize_text_field(wp_unslash($_POST['proj_id']))) : '' ; | |
| 8 | -$comment_id = isset($_POST['comment_id']) ? absint(sanitize_text_field(wp_unslash($_POST['comment_id']))) : 0 ; | |
| 9 | -$task_comment = $wppmfunction->get_task_comment($comment_id); | |
| 10 | -if (!(($current_user->ID && $current_user->has_cap('manage_options')) || $wppmfunction->has_comment_permission('delete_task_thread',$task_id,$comment_id))) {exit;} | |
| 11 | -ob_start(); | |
| 12 | -?> | |
| 13 | -<form id="frm_delete_task_thread"> | |
| 14 | - <p><?php echo esc_html_e('Are you sure to delete this thread?','taskbuilder');?></p> | |
| 15 | - <input type="hidden" name="action" value="wppm_set_delete_thread" /> | |
| 16 | - <input type="hidden" name="_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_set_delete_thread' ) ); ?>"> | |
| 17 | - <input type="hidden" name="task_id" value="<?php echo (esc_attr($task_id))?>" /> | |
| 18 | - <input type="hidden" name="comment_id" value="<?php echo (esc_attr($comment_id))?>" /> | |
| 19 | -</form> | |
| 20 | -<?php | |
| 21 | -$body = ob_get_clean(); | |
| 22 | -ob_start(); | |
| 23 | -?> | |
| 24 | -<div class="row"> | |
| 25 | - <div class="col-md-12" style="text-align: right;"> | |
| 26 | - <button type="button" class="btn <?php echo ($proj_id!=0)?'wppm_modal_close':'wppm_task_modal_close'?>" onclick="<?php echo ($proj_id!=0)?'wppm_modal_close();':'wppm_task_modal_close();'?>"><?php echo esc_html_e('Close','taskbuilder');?></button> | |
| 27 | - <button type="button" class="btn <?php echo ($proj_id!=0)?'wppm_popup_action':'wppm_task_popup_action'?>" onclick="wppm_set_delete_thread(<?php echo (esc_js($task_id)); ?>,<?php echo esc_js($proj_id); ?>);"><?php echo esc_html_e('Confirm','taskbuilder');?></button> | |
| 28 | - </div> | |
| 29 | -</div> | |
| 30 | -<?php | |
| 31 | -$footer = ob_get_clean(); | |
| 32 | -$output = array( | |
| 33 | - 'body' => $body, | |
| 34 | - 'footer' => $footer | |
| 35 | -); | |
| 36 | -echo wp_json_encode($output); | |
| 1 | +<?php | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; // Exit if accessed directly | |
| 4 | +} | |
| 5 | +global $wpdb,$wppmfunction,$current_user; | |
| 6 | +$task_id = isset($_POST['task_id']) ? absint(sanitize_text_field(wp_unslash($_POST['task_id']))) : '' ; | |
| 7 | +$proj_id = isset($_POST['proj_id']) ? absint(sanitize_text_field(wp_unslash($_POST['proj_id']))) : '' ; | |
| 8 | +$comment_id = isset($_POST['comment_id']) ? absint(sanitize_text_field(wp_unslash($_POST['comment_id']))) : 0 ; | |
| 9 | +$task_comment = $wppmfunction->get_task_comment($comment_id); | |
| 10 | +if (!(($current_user->ID && $current_user->has_cap('manage_options')) || $wppmfunction->has_comment_permission('delete_task_thread',$task_id,$comment_id))) {exit;} | |
| 11 | +ob_start(); | |
| 12 | +?> | |
| 13 | +<form id="frm_delete_task_thread"> | |
| 14 | + <p><?php echo esc_html_e('Are you sure to delete this thread?','taskbuilder');?></p> | |
| 15 | + <input type="hidden" name="action" value="wppm_set_delete_thread" /> | |
| 16 | + <input type="hidden" name="_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_set_delete_thread' ) ); ?>"> | |
| 17 | + <input type="hidden" name="task_id" value="<?php echo (esc_attr($task_id))?>" /> | |
| 18 | + <input type="hidden" name="comment_id" value="<?php echo (esc_attr($comment_id))?>" /> | |
| 19 | +</form> | |
| 20 | +<?php | |
| 21 | +$body = ob_get_clean(); | |
| 22 | +ob_start(); | |
| 23 | +?> | |
| 24 | +<div class="row"> | |
| 25 | + <div class="col-md-12" style="text-align: right;"> | |
| 26 | + <button type="button" class="btn <?php echo ($proj_id!=0)?'wppm_modal_close':'wppm_task_modal_close'?>" onclick="<?php echo ($proj_id!=0)?'wppm_modal_close();':'wppm_task_modal_close();'?>"><?php echo esc_html_e('Close','taskbuilder');?></button> | |
| 27 | + <button type="button" class="btn <?php echo ($proj_id!=0)?'wppm_popup_action':'wppm_task_popup_action'?>" onclick="wppm_set_delete_thread(<?php echo (esc_js($task_id)); ?>,<?php echo esc_js($proj_id); ?>);"><?php echo esc_html_e('Confirm','taskbuilder');?></button> | |
| 28 | + </div> | |
| 29 | +</div> | |
| 30 | +<?php | |
| 31 | +$footer = ob_get_clean(); | |
| 32 | +$output = array( | |
| 33 | + 'body' => $body, | |
| 34 | + 'footer' => $footer | |
| 35 | +); | |
| 36 | +echo wp_json_encode($output); | |
| 37 | 37 | ?> |