function delete($id = FALSE) { if ($id) { $alert = new blogcomment_alert(); $alert->get_by_blogcomment_id($id); $alert->delete_all(); $comment = new blogcomment($id); $comment->delete(); set_notify('success', lang('delete_data_complete')); } redirect('blogs/admin/blogs'); }
function commentdel($id) { $comment = new blogcomment($id); if ($comment->blogpost->blog->user->id == $this->session->userdata('id')) { $comment->delete(); set_notify('success', 'ลบความคิดเห็นเรียบร้อยแล้วค่ะ'); } else { set_notify('error', 'คุณไม่มีสิทธิลบความคิดเห็นนี้'); } redirect($_SERVER['HTTP_REFERER']); }