diff options
Diffstat (limited to 'modules/comment/controllers')
-rw-r--r-- | modules/comment/controllers/admin_comments.php | 3 | ||||
-rw-r--r-- | modules/comment/controllers/comments.php | 15 |
2 files changed, 17 insertions, 1 deletions
diff --git a/modules/comment/controllers/admin_comments.php b/modules/comment/controllers/admin_comments.php index 68ede43d..c4bdb92b 100644 --- a/modules/comment/controllers/admin_comments.php +++ b/modules/comment/controllers/admin_comments.php @@ -126,6 +126,9 @@ class Admin_Comments_Controller extends Admin_Controller { $comment->state = $state; $comment->save(); module::event("comment_updated", $orig, $comment); + if ($orig->state == "published" || $comment->state == "published") { + module::event("item_related_update", $comment->item); + } } } diff --git a/modules/comment/controllers/comments.php b/modules/comment/controllers/comments.php index 998ed1ac..1b936671 100644 --- a/modules/comment/controllers/comments.php +++ b/modules/comment/controllers/comments.php @@ -59,7 +59,20 @@ class Comments_Controller extends REST_Controller { access::required("view", $item); $form = comment::get_add_form($item); - if ($form->validate()) { + $valid = $form->validate(); + if ($valid) { + if (user::active()->guest && !$form->add_comment->inputs["name"]->value) { + $form->add_comment->inputs["name"]->add_error("missing", 1); + $valid = false; + } + + if (!$form->add_comment->text->value) { + $form->add_comment->text->add_error("missing", 1); + $valid = false; + } + } + + if ($valid) { $comment = comment::create( $item, user::active(), $form->add_comment->text->value, |