summaryrefslogtreecommitdiff
path: root/modules/comment/helpers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-01-16 04:06:03 +0000
committerBharat Mediratta <bharat@menalto.com>2009-01-16 04:06:03 +0000
commit2920640c2b0a4c2c1e5c47aac285ebec49cd6241 (patch)
tree3b16900c856f2c0865a5bdaeca3e20ee2e7e26ee /modules/comment/helpers
parentecf94c74d8f9712c5bd09058cf1ff14bec32ac98 (diff)
Fix validation when adding new comments.
Fire off the appropriate item_related_update events as appropriate.
Diffstat (limited to 'modules/comment/helpers')
-rw-r--r--modules/comment/helpers/comment.php9
1 files changed, 8 insertions, 1 deletions
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;
}