]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
events for validating outgoing invites
authorEvan Prodromou <evan@status.net>
Mon, 11 Apr 2011 20:49:28 +0000 (16:49 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 11 Apr 2011 20:49:28 +0000 (16:49 -0400)
EVENTS.txt
actions/invite.php

index 6ac607382b790db68ec08c7bd74ac653a30a959e..aca9e8f73d5d608bcb2d3b3417a5a45a1a876f4c 100644 (file)
@@ -1342,3 +1342,12 @@ EndAddEmailAddress: done adding an email address through the Web UI
 - $user: user getting the new address
 - $email: email being added
 
+StartValidateEmailInvite: when validating an email address for invitations
+- $user: user doing the invite
+- $email: email address
+- &$valid: flag for if it's valid; can be modified
+
+EndValidateEmailInvite: after validating an email address for invitations
+- $user: user doing the invite
+- $email: email address
+- &$valid: flag for if it's valid; can be modified
index 7a1f8b3f5b16d4f9aac0ac8df6d9dc9a64d34bd9..be2228e703d88eecd82fc8db095ffcab7109b987 100644 (file)
@@ -73,7 +73,14 @@ class InviteAction extends CurrentUserDesignAction
 
         foreach ($addresses as $email) {
             $email = trim($email);
-            if (!Validate::email($email, common_config('email', 'check_domain'))) {
+            $valid = null;
+
+            if (Event::handle('StartValidateEmailInvite', array($user, $email, &$valid))) {
+                $valid = Validate::email($email, common_config('email', 'check_domain'));
+                Event::handle('EndValidateEmailInvite', array($user, $email, &$valid));
+            }
+
+            if (!$valid) {
                 // TRANS: Form validation message when providing an e-mail address that does not validate.
                 // TRANS: %s is an invalid e-mail address.
                 $this->showForm(sprintf(_('Invalid email address: %s.'), $email));