PluginProbe
Taskbuilder – Project Management & Task Management Tool With Kanban Board / 6.0.6
Taskbuilder – Project Management & Task Management Tool With Kanban Board v6.0.6
6.0.6 6.0.5 6.0.2 6.0.3 6.0.4 6.0.1 6.0.0 5.0.8 5.0.9 4.0.9 5.0.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 All 58 releases
← All changes | includes/admin/tasks/wppm_set_delete_task.php +2 -51 5.0.76.0.6 View file →
@@ -14,55 +14,6 @@
14 14 $wppm_current_user_capability = get_user_meta( $current_user->ID, 'wppm_capability', true );
15 15 if(!(($current_user->ID && $current_user->has_cap('manage_options')) || ($wppmfunction->has_permission('delete_task',$task_id)) || $wppm_current_user_capability == 'wppm_admin'|| $project_data['created_by']==$current_user->ID )){
16 16 exit;
17 17 }
18 -$sql=$wpdb->prepare("SELECT attachment_ids FROM {$wpdb->prefix}wppm_task_comment WHERE task_id = %d",$task_id);
19 -$thread_attachment_ids= $wpdb->get_results( $sql );
20 -/***************************Code for deleting attachment files****************************************************/
21 -if(!empty($thread_attachment_ids)){
22 - foreach ($thread_attachment_ids as $thread_attachment_id){
23 - $attachment_ids_temp = array();
24 - if($thread_attachment_id->attachment_ids){
25 - $attachment_ids_temp = explode(',', $thread_attachment_id->attachment_ids);
26 - }
27 - if(!empty($attachment_ids_temp)){
28 - foreach ($attachment_ids_temp as $attachment_id){
29 - $sql=$wpdb->prepare("SELECT * FROM {$wpdb->prefix}wppm_attachments WHERE id = %d",$attachment_id);
30 - $result=$wpdb->get_row($sql);
31 - if(!empty($result)){
32 - $sql_query=$wpdb->prepare("SELECT file_path FROM {$wpdb->prefix}wppm_attachments WHERE file_path = %s",$result->file_path);
33 - $attach_result=$wpdb->get_results($sql_query);
34 - $result_count = count($attach_result);
35 - if(file_exists($result->file_path) && $result_count < 2)
36 - {
37 - wp_delete_file($result->file_path);
38 - }
39 - $wpdb->delete($wpdb->prefix.'wppm_attachments', array( 'id' => absint($attachment_id)));
40 - }
41 - }
42 - }
43 - }
44 -}
45 -/***************************Code for deleting checklists****************************************************/
46 -$sql=$wpdb->prepare("SELECT id FROM {$wpdb->prefix}wppm_checklist WHERE task_id = %d",$task_id);
47 -$checklists = $wpdb->get_results( $sql );
48 -if(!empty($checklists)){
49 - foreach($checklists as $checklist){
50 - $chk_array = (array) $checklist;
51 - $chk_array_id = absint($chk_array['id']);
52 - $sql=$wpdb->prepare("SELECT id FROM {$wpdb->prefix}wppm_checklist_items WHERE checklist_id = %d",$chk_array_id);
53 - $checklist_items = $wpdb->get_results( $sql );
54 - if(!empty($checklist_items)){
55 - foreach($checklist_items as $ch_item){
56 - $chk_items_array = (array) $ch_item;
57 - $chk_items_array_id = absint($chk_items_array['id']);
58 - $wpdb->delete($wpdb->prefix.'wppm_checklist_items',array('id'=>$chk_items_array_id));
59 - }
60 - }
61 - $wpdb->delete($wpdb->prefix.'wppm_checklist',array('id'=>$chk_array_id));
62 - }
63 -}
64 -$wpdb->delete($wpdb->prefix.'wppm_task',array('id'=>$task_id));
65 -$wpdb->delete($wpdb->prefix.'wppm_task_meta',array('task_id'=>$task_id));
66 -$wpdb->delete($wpdb->prefix.'wppm_task_comment',array('task_id'=>$task_id)) ;
67 -$wpdb->delete($wpdb->prefix.'wppm_task_comment_meta',array('task_id'=>$task_id));
68 -do_action('wppm_after_delete_task',$task_id);
18 +// Deletes the task's own attachments/checklists/comments, and cascades to any subtasks.
19 +WPPM_Functions::delete_task_and_children($task_id);