diff --git a/code/sitefeatures/PageComment.php b/code/sitefeatures/PageComment.php index 6111e81c..e774d741 100755 --- a/code/sitefeatures/PageComment.php +++ b/code/sitefeatures/PageComment.php @@ -5,6 +5,7 @@ class PageComment extends DataObject { "Name" => "Varchar", "Comment" => "Text", "IsSpam" => "Boolean", + "NeedsModeration" => "Boolean" ); static $has_one = array( @@ -18,6 +19,8 @@ class PageComment extends DataObject { // Number of comments to show before paginating static $comments_per_page = 10; + static $moderate = false; + /** * Return a link to this comment * @return string link to this comment. @@ -135,10 +138,19 @@ class PageComment extends DataObject { return "Comment by '". Convert::raw2xml($this->Name) . "' on " . $this->Parent()->Title; } function rss() { - $rss = new RSSFeed(DataObject::get("PageComment", "ParentID > 0", "Created DESC", "", 10), "home/", "Page comments", "", "RSSTitle", "Comment", "Name"); + $parentcheck = isset($_REQUEST['pageid']) ? "ParentID = {$_REQUEST['pageid']}" : "ParentID > 0"; + $comments = DataObject::get("PageComment", $parentcheck, "Created DESC", "", 10); + if(!isset($comments)) { + $comments = new DataObjectSet(); + } + + $rss = new RSSFeed($comments, "home/", "Page comments", "", "RSSTitle", "Comment", "Name"); $rss->outputToBrowser(); } + static function enableModeration() { + self::$moderate = true; + } } ?> \ No newline at end of file