summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/comment/helpers/comment.php1
-rw-r--r--modules/gallery/helpers/user_profile.php1
-rw-r--r--modules/recaptcha/helpers/recaptcha_event.php22
3 files changed, 11 insertions, 13 deletions
diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php
index 92a286c7..7aa007cb 100644
--- a/modules/comment/helpers/comment.php
+++ b/modules/comment/helpers/comment.php
@@ -45,6 +45,7 @@ class comment_Core {
->error_messages("required", t("You must enter a comment"));
$group->hidden("item_id")->value($item->id);
module::event("comment_add_form", $form);
+ module::event("captcha_protect_form", $form);
$group->submit("")->value(t("Add"))->class("ui-state-default ui-corner-all");
return $form;
diff --git a/modules/gallery/helpers/user_profile.php b/modules/gallery/helpers/user_profile.php
index e853933f..d9cc8ace 100644
--- a/modules/gallery/helpers/user_profile.php
+++ b/modules/gallery/helpers/user_profile.php
@@ -48,6 +48,7 @@ class user_profile_Core {
->rules("required")
->error_messages("required", t("You must enter a message"));
module::event("user_profile_contact_form", $form);
+ module::event("captcha_protect_form", $form);
$group->submit("")->value(t("Send"));
return $form;
}
diff --git a/modules/recaptcha/helpers/recaptcha_event.php b/modules/recaptcha/helpers/recaptcha_event.php
index fda998e1..f185f92b 100644
--- a/modules/recaptcha/helpers/recaptcha_event.php
+++ b/modules/recaptcha/helpers/recaptcha_event.php
@@ -18,21 +18,17 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class recaptcha_event_Core {
- static function user_profile_contact_form($form) {
+ static function captcha_protect_form($form) {
if (module::get_var("recaptcha", "public_key")) {
- $form->message->recaptcha("recaptcha")->label("")->id("g-recaptcha");
- }
- }
+ foreach ($form->inputs as $input) {
+ if ($input instanceof Form_Group) {
+ $input->recaptcha("recaptcha")->label("")->id("g-recaptcha");
+ return;
+ }
+ }
- static function comment_add_form($form) {
- if (module::get_var("recaptcha", "public_key")) {
- $form->add_comment->recaptcha("recaptcha")->label("")->id("g-recaptcha");
- }
- }
-
- static function register_add_form($form) {
- if (module::get_var("recaptcha", "public_key")) {
- $form->register_user->recaptcha("recaptcha")->label("")->id("g-recaptcha");
+ // If we haven't returned yet, then add the captcha at the end of the form
+ $form->recaptcha("recaptcha")->label("")->id("g-recaptcha");
}
}