From 475b872eb80583c7d3e0e28c60bf489f37883b6b Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 7 Aug 2007 04:32:52 +0000 Subject: [PATCH] Allow specifying the page in page comment rss feeds git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@39681 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/sitefeatures/PageComment.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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