X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FTwitterBridge%2Ftwitterauthorization.php;h=972fa527d41340fac906c14482bb2064237002d3;hb=4e1ce4e5bbc43869dc7c85463f9a733da9f5fda4;hp=cc3af588789f5d780497a79d5729db19608e3afe;hpb=7a9040e3607387d64cf5b3098ab787c37cdacac5;p=quix0rs-gnu-social.git diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php index cc3af58878..972fa527d4 100644 --- a/plugins/TwitterBridge/twitterauthorization.php +++ b/plugins/TwitterBridge/twitterauthorization.php @@ -382,11 +382,24 @@ class TwitterauthorizationAction extends Action $this->element('p', null, _m('Create a new user with this nickname.')); $this->elementStart('ul', 'form_data'); + + // Hook point for captcha etc + Event::handle('StartRegistrationFormData', array($this)); + $this->elementStart('li'); $this->input('newname', _m('New nickname'), ($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)); + $this->elementEnd('ul'); $this->submit('create', _m('Create')); $this->elementEnd('fieldset'); @@ -411,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; @@ -470,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)) {