From ad0e7254eb6e6a763c9b4d0a7252dc5982a814be Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 14 May 2010 16:19:53 -0700 Subject: Require a well-formed email address for all comments. --- modules/comment/helpers/comment.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'modules/comment/helpers') 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; } } -- cgit v1.2.3