X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FTwitterBridge%2Ftwitterauthorization.php;h=972fa527d41340fac906c14482bb2064237002d3;hb=4e1ce4e5bbc43869dc7c85463f9a733da9f5fda4;hp=e78ba6a674e1c392db9fe20b73fb002d9cf32aab;hpb=c1e4be6ab937b6be17ce3424a674af5de2188682;p=quix0rs-gnu-social.git diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php index e78ba6a674..972fa527d4 100644 --- a/plugins/TwitterBridge/twitterauthorization.php +++ b/plugins/TwitterBridge/twitterauthorization.php @@ -391,6 +391,11 @@ class TwitterauthorizationAction extends Action ($this->username) ? $this->username : '', _m('1-64 lowercase letters or numbers, no punctuation or spaces')); $this->elementEnd('li'); + $this->elementStart('li'); + $this->input('email', _('Email'), $this->getEmail(), + _('Used only for updates, announcements, '. + 'and password recovery')); + $this->elementEnd('li'); // Hook point for captcha etc Event::handle('EndRegistrationFormData', array($this)); @@ -419,6 +424,32 @@ class TwitterauthorizationAction extends Action $this->elementEnd('form'); } + /** + * Get specified e-mail from the form, or the invite code. + * + * @return string + */ + function getEmail() + { + $email = $this->trimmed('email'); + if (!empty($email)) { + return $email; + } + + // Terrible hack for invites... + if (common_config('site', 'inviteonly')) { + $code = $_SESSION['invitecode']; + if ($code) { + $invite = Invitation::staticGet($code); + + if ($invite && $invite->address_type == 'email') { + return $invite->address; + } + } + } + return ''; + } + function message($msg) { $this->message_text = $msg; @@ -478,6 +509,11 @@ class TwitterauthorizationAction extends Action $args['code'] = $invite->code; } + $email = $this->getEmail(); + if (!empty($email)) { + $args['email'] = $email; + } + $user = User::register($args); if (empty($user)) {