diff --git a/code/sitefeatures/PageCommentInterface.php b/code/sitefeatures/PageCommentInterface.php index cacc6a8d..d1c4e7a0 100755 --- a/code/sitefeatures/PageCommentInterface.php +++ b/code/sitefeatures/PageCommentInterface.php @@ -343,13 +343,15 @@ class PageCommentInterface_Form extends Form { if($comment->NeedsModeration){ $this->sessionMessage($moderationMsg, 'good'); } - // since it is not ajax redirect user down to their comment since it has been posted - // get the pages url off the comments parent ID. + if($comment->ParentID) { $page = DataObject::get_by_id("Page", $comment->ParentID); if($page) { - // Redirect to the actual post on the page. - return Director::redirect($page->Link() . '#PageComment_' . $comment->ID); + // if it needs moderation then it won't appear in the list. Therefore + // we need to link to the comment holder rather than the individual comment + $url = ($comment->NeedsModeration) ? $page->Link() . '#PageComments_holder' : $page->Link() . '#PageComment_' . $comment->ID; + + return Director::redirect($url); } } @@ -374,4 +376,4 @@ class PageCommentInterface_Controller extends ContentController { } } -?> +?> \ No newline at end of file