summaryrefslogtreecommitdiff
path: root/modules/comment/helpers/comment.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-05-14 16:19:53 -0700
committerBharat Mediratta <bharat@menalto.com>2010-05-14 16:19:53 -0700
commitad0e7254eb6e6a763c9b4d0a7252dc5982a814be (patch)
treef79887f228374640ab2cc80f3c638fc3eb62e1b4 /modules/comment/helpers/comment.php
parent9affa8ebbd539396d71f19003b91af577a8a183e (diff)
Require a well-formed email address for all comments.
Diffstat (limited to 'modules/comment/helpers/comment.php')
-rw-r--r--modules/comment/helpers/comment.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php
index e3486e83..94b14d0d 100644
--- a/modules/comment/helpers/comment.php
+++ b/modules/comment/helpers/comment.php
@@ -33,7 +33,9 @@ class comment_Core {
->error_messages("required", t("You must enter a name for yourself"));
$group->input("email")
->label(t("Email (hidden)"))
- ->id("g-email");
+ ->id("g-email")
+ ->error_messages("required", t("You must enter a valid email address"))
+ ->error_messages("invalid", t("You must enter a valid email address"));
$group->input("url")
->label(t("Website (hidden)"))
->id("g-url");
@@ -45,13 +47,17 @@ class comment_Core {
module::event("comment_add_form", $form);
$group->submit("")->value(t("Add"))->class("ui-state-default ui-corner-all");
+ return $form;
+ }
+
+ static function prefill_add_form($form) {
$active = identity::active_user();
if (!$active->guest) {
+ $group = $form->add_comment;
$group->inputs["name"]->value($active->full_name)->disabled("disabled");
$group->email->value($active->email)->disabled("disabled");
$group->url->value($active->url)->disabled("disabled");
}
-
return $form;
}
}