| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
global $wpdb,$wppmfunction,$current_user; |
| 6 |
$proj_id = isset($_POST['proj_id']) ? intval(sanitize_text_field($_POST['proj_id'])) : '' ; |
| 7 |
$comment_id = isset($_POST['comment_id']) ? sanitize_text_field($_POST['comment_id']) : 0 ; |
| 8 |
$project_comment = $wppmfunction->get_proj_comment($comment_id); |
| 9 |
if (!(($current_user->ID && $current_user->has_cap('manage_options')) || $wppmfunction->has_proj_comment_permission('delete_proj_thread',$proj_id,$comment_id))) {exit;} |
| 10 |
ob_start(); |
| 11 |
?> |
| 12 |
<form id="frm_delete_proj_thread"> |
| 13 |
<p><?php echo esc_html_e('Are you sure to delete this thread?','taskbuilder');?></p> |
| 14 |
<input type="hidden" name="action" value="wppm_set_delete_proj_thread" /> |
| 15 |
<input type="hidden" name="_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_set_delete_proj_thread' ) ); ?>"> |
| 16 |
<input type="hidden" name="proj_id" value="<?php echo htmlentities(esc_attr($proj_id))?>" /> |
| 17 |
<input type="hidden" name="comment_id" value="<?php echo htmlentities(esc_attr($comment_id))?>" /> |
| 18 |
</form> |
| 19 |
<?php |
| 20 |
$body = ob_get_clean(); |
| 21 |
ob_start(); |
| 22 |
?> |
| 23 |
<div class="row"> |
| 24 |
<div class="col-md-12" style="text-align: right;"> |
| 25 |
<button type="button" class="btn wppm_modal_close" onclick="wppm_modal_close()"><?php echo esc_html_e('Cancel','taskbuilder');?></button> |
| 26 |
<button type="button" class="btn wppm_popup_action" onclick="wppm_set_delete_proj_thread(<?php echo esc_attr($proj_id); ?>);"><?php echo esc_html_e('Confirm','taskbuilder');?></button> |
| 27 |
</div> |
| 28 |
</div> |
| 29 |
<?php |
| 30 |
$footer = ob_get_clean(); |
| 31 |
$output = array( |
| 32 |
'body' => $body, |
| 33 |
'footer' => $footer |
| 34 |
); |
| 35 |
echo json_encode($output); |
| 36 |
?> |