diff --git a/code/sitefeatures/PageCommentInterface.php b/code/sitefeatures/PageCommentInterface.php index 9823bc54..5ce532c6 100755 --- a/code/sitefeatures/PageCommentInterface.php +++ b/code/sitefeatures/PageCommentInterface.php @@ -214,15 +214,14 @@ class PageCommentInterface extends RequestHandler { Requirements::javascript(CMS_DIR . '/javascript/PageCommentInterface.js'); } - // Load the data from Session - $form->loadDataFrom(array( - "Name" => Cookie::get("PageCommentInterface_Name"), - "Comment" => Cookie::get("PageCommentInterface_Comment"), - "CommenterURL" => Cookie::get("PageCommentInterface_CommenterURL") - )); - $this->extend('updatePageCommentForm', $form); + // Load the users data from a cookie + if($cookie = Cookie::get("PageCommentInterface_Data")) { + Debug::show(unserialize($cookie)); + $form->loadDataFrom(unserialize($cookie)); + } + return $form; } @@ -269,11 +268,10 @@ class PageCommentInterface extends RequestHandler { */ class PageCommentInterface_Form extends Form { function postcomment($data) { - // Spam filtering - Cookie::set("PageCommentInterface_Name", $data['Name']); - Cookie::set("PageCommentInterface_CommenterURL", $data['CommenterURL']); - Cookie::set("PageCommentInterface_Comment", $data['Comment']); + Debug::show($data); + Cookie::set("PageCommentInterface_Data", serialize($data)); + // Spam filtering if(SSAkismet::isEnabled()) { try { $akismet = new SSAkismet(); @@ -331,7 +329,8 @@ class PageCommentInterface_Form extends Form { $comment->NeedsModeration = PageComment::moderationEnabled(); $comment->write(); - Cookie::set("PageCommentInterface_Comment", ''); + unset($data['Comment']); + Cookie::set("PageCommentInterface_Data", serialize($data)); $moderationMsg = _t('PageCommentInterface_Form.AWAITINGMODERATION', "Your comment has been submitted and is now awaiting moderation.");