load($comment_id); $params = array('comment_info'=>array('user_id'=>$comment->user_id, 'content_id'=>$comment->content_id), 'action'=>'delete_comment'); $cid = $comment->content_id;//Content id for which comment has been posted. if (user_can($params)) { //user_can function defined in web/functions.php will check the delete permission for a comment $comment = new Comment(); $comment->comment_id = $comment_id; $comment->delete(); } else { throw new PAException(CONTENT_NOT_AUTHORISED_TO_ACCESS, "You are not authorised to access this page."); } $err = "Comment deleted successfully"; //invalidate cache of this content if ($network_info) { $nid = '_network_'.$network_info->network_id; } else { $nid=''; } //unique name $cache_id = 'content_'.$cid.$nid; CachedTemplate::invalidate_cache($cache_id); if ($content->parent_collection_id > 0) { $location = "$base_url/content.php?cid=$cid&err=$err"; } else { $location = "$base_url/content.php?cid=$cid&err=$err"; } header("Location: $location"); exit; } ?>