get_row( "SELECT * FROM {$wpdb->prefix}wppm_task_comment where id = $comment_id AND task_id=$task_id"); if(!(((!empty($task_comment)) && ($task_comment->created_by == $current_user->ID)) || ($current_user->has_cap('manage_options')) || ($wppmfunction->has_comment_permission('edit_task_comment',$task_id,$comment_id)))){ exit; } $success = $wpdb->delete( $wpdb->prefix . 'wppm_attachments', array( 'id' => $attachment ) ); if( !$success ) return false; $task_attachment = $wpdb->get_var("SELECT attachment_ids FROM {$wpdb->prefix}wppm_task_comment WHERE id=$comment_id "); $task_attachment = explode(",",$task_attachment); if(!empty($task_attachment)){ foreach($task_attachment as $key=>$val){ if($val == $attachment){ unset($task_attachment[$key]); } } } $tattachment = implode(',',$task_attachment); $values=array( 'attachment_ids'=>$tattachment ); $wpdb->update($wpdb->prefix.'wppm_task_comment', $values, array('id'=>$comment_id)); $attachment = apply_filters('wppm_after_delete_comment_attachment',$attachment,$comment_id,$task_id);