From 2920640c2b0a4c2c1e5c47aac285ebec49cd6241 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 16 Jan 2009 04:06:03 +0000 Subject: Fix validation when adding new comments. Fire off the appropriate item_related_update events as appropriate. --- modules/comment/helpers/comment.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'modules/comment/helpers/comment.php') diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php index 329d5ba3..6e204ace 100644 --- a/modules/comment/helpers/comment.php +++ b/modules/comment/helpers/comment.php @@ -59,9 +59,13 @@ class comment_Core { $comment->server_remote_addr = substr($input->server("REMOTE_ADDR"), 0, 32); $comment->server_remote_host = substr($input->server("REMOTE_HOST"), 0, 64); $comment->server_remote_port = substr($input->server("REMOTE_PORT"), 0, 16); - $comment->save(); + module::event("comment_created", $comment); + if ($comment->state == "published") { + module::event("item_related_update", $comment->item()); + } + return $comment; } @@ -87,7 +91,10 @@ class comment_Core { $group->inputs["name"]->value($active->full_name)->disabled("disabled"); $group->email->value($active->email)->disabled("disabled"); $group->url->value($active->url)->disabled("disabled"); + } else { + $group->inputs["name"]->error_messages("missing", t("You must provide a name")); } + $group->text->error_messages("missing", t("You must provide a comment")); return $form; } -- cgit v1.2.3