summaryrefslogtreecommitdiff
path: root/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-10 10:06:46 -0800
committerBrion Vibber <brion@pobox.com>2010-03-10 10:06:46 -0800
commit69b2f19b6fef793aa607c6d8f4590b93e2565626 (patch)
tree76eae27ba51ae642db93f3db0a3a83fda573a352 /plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php
parent58fcb5ac6f91d30a25a4fa03ba87855923c35828 (diff)
RequireValidatedEmailPlugin fixes: require email on registration form, tidy up i18n infrastructure.
Diffstat (limited to 'plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php')
-rw-r--r--plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php b/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php
index 3581f1de9..ccefa14f6 100644
--- a/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php
+++ b/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php
@@ -54,13 +54,34 @@ class RequireValidatedEmailPlugin extends Plugin
$user = User::staticGet('id', $notice->profile_id);
if (!empty($user)) { // it's a remote notice
if (!$this->validated($user)) {
- throw new ClientException(_("You must validate your email address before posting."));
+ throw new ClientException(_m("You must validate your email address before posting."));
}
}
return true;
}
/**
+ * Event handler for registration attempts; rejects the registration
+ * if email field is missing.
+ *
+ * @param RegisterAction $action
+ * @return bool hook result code
+ */
+ function onStartRegistrationTry($action)
+ {
+ $email = $action->trimmed('email');
+
+ if (empty($email)) {
+ $action->showForm(_m('You must provide an email address to register.'));
+ return false;
+ }
+
+ // Default form will run address format validation and reject if bad.
+
+ return true;
+ }
+
+ /**
* Check if a user has a validated email address or has been
* otherwise grandfathered in.
*