== Adding MF/PL statement check box
In order to add a check box to have users agree to the MF/PL Statement of Unity I edited two files: `actions/register.php` and `plugins/OpenID/actions/finishopenidlogin.php`. The exact changes are shown below from the output of `git diff`.
{{{
diff --git a/actions/register.php b/actions/register.php
index 82fb9fc..8ae5c00 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -200,6 +200,10 @@ class RegisterAction extends Action
// TRANS: Form validation error displayed when trying to register without agreeing to the site license.
$this->showForm(_('You cannot register if you do not '.
'agree to the license.'));
+ } else if (!$this->boolean('mfpl_statement')) {
+ // TRANS: Form validation error displayed when trying to register without agreeing to the statement.
+ $this->showForm(_('You cannot register if you do not '.
+ 'agree to the MF/PL Statement of Unity.'));
} else if ($email && !Validate::email($email, common_config('email', 'check_domain'))) {
// TRANS: Form validation error displayed when trying to register without a valid e-mail address.
$this->showForm(_('Not a valid email address.'));
@@ -499,6 +503,21 @@ class RegisterAction extends Action
$this->raw($this->licenseCheckbox());
$this->elementEnd('label');
$this->elementEnd('li');
+ // MFPL statement
+ $attrs = array('type' => 'checkbox',
+ 'id' => 'mfpl_statement',
+ 'class' => 'checkbox',
+ 'name' => 'mfpl_statement',
+ 'value' => 'true');
+ if ($this->boolean('mfpl_statement')) {
+ $attrs['checked'] = 'checked';
+ }
+ $this->elementStart('li');
+ $this->element('input', $attrs);
+ $this->elementStart('label', array('class' => 'checkbox', 'for' => 'mfpl_statement'));
+ $this->raw($this->statementCheckbox());
+ $this->elementEnd('label');
+ $this->elementEnd('li');
}
$this->elementEnd('ul');
// TRANS: Button text to register a user on account registration page.
@@ -541,7 +560,7 @@ class RegisterAction extends Action
$message = _('My text and files are available under %s ' .
'except this private data: password, ' .
'email address, IM address, and phone number.');
- $link = '' .
htmlspecialchars(common_config('license', 'title')) .
@@ -551,6 +570,12 @@ class RegisterAction extends Action
return $out;
}
+ function statementCheckbox()
+ {
+ // TRANS: Statement checkbox label in registration dialog.
+ return _('I agree to the May First/People Link Statement of Unity.');
+ }
+
/**
* Show some information about registering for the site
*
}}}
{{{
diff --git a/plugins/OpenID/actions/finishopenidlogin.php b/plugins/OpenID/actions/finishopenidlogin.php
index 3a99988..755516d 100644
--- a/plugins/OpenID/actions/finishopenidlogin.php
+++ b/plugins/OpenID/actions/finishopenidlogin.php
@@ -49,6 +49,12 @@ class FinishopenidloginAction extends Action
$this->trimmed('newname'));
return;
}
+ if (!$this->boolean('mfpl_statement')) {
+ // TRANS: Message given if user does not agree with the statement.
+ $this->showForm(_m('You cannot register if you do not agree to the MF/PL Statement of Unity.'),
+ $this->trimmed('newname'));
+ return;
+ }
$this->createNewUser();
} else if ($this->arg('connect')) {
$this->connectUser();
@@ -155,7 +161,7 @@ class FinishopenidloginAction extends Action
$message = _m('My text and files are available under %s ' .
'except this private data: password, ' .
'email address, IM address, and phone number.');
- $link = '' .
htmlspecialchars(common_config('license', 'title')) .
@@ -163,6 +169,23 @@ class FinishopenidloginAction extends Action
$this->raw(sprintf(htmlspecialchars($message), $link));
$this->elementEnd('label');
$this->elementEnd('li');
+
+ // MFPL statement
+ $this->elementStart('li');
+ $this->element('input', array('type' => 'checkbox',
+ 'id' => 'mfpl_statement',
+ 'class' => 'checkbox',
+ 'name' => 'mfpl_statement',
+ 'value' => 'true'));
+ $this->elementStart('label', array('for' => 'mfpl_statement',
+ 'class' => 'checkbox'));
+ // TRANS: OpenID plugin link text.
+ // TRANS: %s is a link to a license with the license name as link text.
+ $message = _m('I agree to the May First/People Link Statement of Unity.');
+ $this->raw($message);
+ $this->elementEnd('label');
+ $this->elementEnd('li');
+
$this->elementEnd('ul');
// TRANS: Button label in form in which to create a new user on the site for an OpenID.
$this->submit('create', _m('BUTTON', 'Create'));
}}}