diff options
Diffstat (limited to 'modules/comment/controllers/comments.php')
-rw-r--r-- | modules/comment/controllers/comments.php | 15 |
1 files changed, 14 insertions, 1 deletions
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, |