From a4e679a11858031edec63cc5a6625b062f2bcd60 Mon Sep 17 00:00:00 2001 From: Diogo Cordeiro Date: Fri, 26 Apr 2019 00:59:38 +0100 Subject: [PATCH] Add Registration form hook points by XRevan86 --- .../forms/confirmregistration.php | 45 ++++++++++++------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/plugins/EmailRegistration/forms/confirmregistration.php b/plugins/EmailRegistration/forms/confirmregistration.php index 7618410e8e..a15fd2b967 100644 --- a/plugins/EmailRegistration/forms/confirmregistration.php +++ b/plugins/EmailRegistration/forms/confirmregistration.php @@ -46,32 +46,38 @@ if (!defined('STATUSNET')) { */ class ConfirmRegistrationForm extends Form { + protected $action; protected $code; protected $nickname; protected $email; - function __construct($out, $nickname, $email, $code) + public function __construct($out, $nickname, $email, $code) { parent::__construct($out); + $this->action = $out; $this->nickname = $nickname; $this->email = $email; $this->code = $code; } - function formData() + public function formData() { $this->out->element('p', 'instructions', // TRANS: Form instructions. - sprintf(_m('Enter a password to confirm your new account.'))); + sprintf(_m('Enter a password to confirm your new account.')) + ); $this->hidden('code', $this->code); $this->out->elementStart('ul', 'form_data'); + // Hook point for captcha etc + Event::handle('StartRegistrationFormData', array($this->action)); + $this->elementStart('li'); // TRANS: Field label in e-mail registration form. - $this->element('label', array('for' => 'nickname'), _m('LABEL','User name')); + $this->element('label', array('for' => 'nickname'), _m('LABEL', 'User name')); $this->element('input', array('name' => 'nickname', 'type' => 'text', @@ -97,15 +103,20 @@ class ConfirmRegistrationForm extends Form // TRANS: Field label on account registration page. $this->password('password1', _m('Password'), // TRANS: Field title on account registration page. - _m('6 or more characters.')); + _m('6 or more characters.') + ); $this->elementEnd('li'); $this->elementStart('li'); // TRANS: Field label on account registration page. In this field the password has to be entered a second time. - $this->password('password2', _m('PASSWORD','Confirm'), + $this->password('password2', _m('PASSWORD', 'Confirm'), // TRANS: Field title on account registration page. - _m('Same as password above.')); + _m('Same as password above.') + ); $this->elementEnd('li'); + // Hook point for captcha etc + Event::handle('EndRegistrationFormData', array($this->action)); + $this->elementStart('li'); $this->element('input', array('name' => 'tos', @@ -119,10 +130,12 @@ class ConfirmRegistrationForm extends Form 'for' => 'tos')); // TRANS: Checkbox title for terms of service and privacy policy. - $this->raw(sprintf(_m('I agree to the Terms of service and '. - 'Privacy policy of this site.'), - common_local_url('doc', array('title' => 'tos')), - common_local_url('doc', array('title' => 'privacy')))); + $this->raw(sprintf( + _m('I agree to the Terms of service and '. + 'Privacy policy of this site.'), + common_local_url('doc', array('title' => 'tos')), + common_local_url('doc', array('title' => 'privacy')) + )); $this->elementEnd('label'); @@ -131,7 +144,7 @@ class ConfirmRegistrationForm extends Form $this->out->elementEnd('ul'); } - function method() + public function method() { return 'post'; } @@ -145,7 +158,7 @@ class ConfirmRegistrationForm extends Form * @return void */ - function formActions() + public function formActions() { // TRANS: Button text for action to register. $this->out->submit('submit', _m('BUTTON', 'Register')); @@ -160,7 +173,7 @@ class ConfirmRegistrationForm extends Form * @return int ID of the form */ - function id() + public function id() { return 'form_email_registration'; } @@ -174,12 +187,12 @@ class ConfirmRegistrationForm extends Form * @return string URL to post to */ - function action() + public function action() { return common_local_url('register'); } - function formClass() + public function formClass() { return 'form_confirm_registration form_settings'; }