Commit f5435266 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Add the option Require 'Confirm registrations' (Bug 1280882)"

parents f9f71740 fe14bc4d
......@@ -123,6 +123,13 @@ $siteoptionform = array(
'collapsed' => true,
'legend' => get_string('usersettingslegend', 'admin'),
'elements' => array(
'requireregistrationconfirm' => array(
'type' => 'checkbox',
'title' => get_string('requireregistrationconfirm', 'admin'),
'description' => get_string('requireregistrationconfirmdescription', 'admin'),
'defaultvalue' => get_config('requireregistrationconfirm'),
'help' => true,
),
'userscanchooseviewthemes' => array(
'type' => 'checkbox',
'title' => get_string('userscanchooseviewthemes', 'admin'),
......@@ -727,7 +734,7 @@ function siteoptions_submit(Pieform $form, $values) {
'sitename','lang','theme', 'dropdownmenu',
'defaultaccountlifetime', 'defaultregistrationexpirylifetime', 'defaultaccountinactiveexpire', 'defaultaccountinactivewarn',
'defaultaccountlifetimeupdate', 'allowpublicviews', 'allowpublicprofiles', 'generatesitemap',
'registration_sendweeklyupdates', 'institutionexpirynotification', 'institutionautosuspend',
'registration_sendweeklyupdates', 'institutionexpirynotification', 'institutionautosuspend', 'requireregistrationconfirm',
'showselfsearchsideblock', 'searchusernames', 'searchplugin', 'showtagssideblock',
'tagssideblockmaxtags', 'country', 'viewmicroheaders', 'userscanchooseviewthemes',
'remoteavatars', 'userscanhiderealnames', 'antispam', 'spamhaus', 'surbl', 'anonymouscomments',
......
......@@ -332,7 +332,8 @@ if ($institution || $add) {
$elements['registerconfirm'] = array(
'type' => 'checkbox',
'title' => get_string('registrationconfirm', 'admin'),
'description' => get_string('registrationconfirmdescription', 'admin'),
'description' => get_string('registrationconfirmdescription1', 'admin'),
'disabled' => get_config('requireregistrationconfirm') == true,
'defaultvalue' => $data->registerconfirm,
);
}
......
......@@ -2031,7 +2031,7 @@ function auth_generate_registration_form($formname, $authname='internal', $goto)
$options = array();
foreach ($institutions as $institution) {
$options[$institution->name] = $institution->displayname;
if ($registerconfirm[$institution->name] = $institution->registerconfirm) {
if ($registerconfirm[$institution->name] = (get_config('requireregistrationconfirm') || $institution->registerconfirm)) {
if ($authname != 'internal') {
$authinstance = get_record('auth_instance', 'institution', $institution->name, 'authname', $authname);
$auth = AuthFactory::create($authinstance->id);
......@@ -2282,7 +2282,7 @@ function auth_register_submit(Pieform $form, $values) {
// If the institution requires approval, mark the record as pending
// @todo the expiry date should be configurable
if ($confirm = get_field('institution', 'registerconfirm', 'name', $values['institution'])) {
if ($confirm = (get_config('requireregistrationconfirm') || get_field('institution', 'registerconfirm', 'name', $values['institution']))) {
if (isset($values['authtype']) && $values['authtype'] != 'internal') {
$authinstance = get_record('auth_instance', 'institution', $values['institution'], 'authname', $values['authtype'] ? $values['authtype'] : 'internal');
$auth = AuthFactory::create($authinstance->id);
......
......@@ -399,6 +399,8 @@ $string['trustedsites'] = 'Trusted sites';
$string['updatesiteoptions'] = 'Update site options';
$string['usersallowedmultipleinstitutions'] = 'Users allowed multiple institutions';
$string['usersallowedmultipleinstitutionsdescription'] = 'If checked, users can be members of several institutions at the same time.';
$string['requireregistrationconfirm'] = 'Confirm registration';
$string['requireregistrationconfirmdescription'] = 'If checked, new self-registered user accounts must be approved by an institution administrator before they will become active. Otherwise, each institution can decide whether or not to require confirmation for new accounts registering in that institution.';
$string['userscanchooseviewthemes'] = 'Users can choose page themes';
$string['userscanchooseviewthemesdescription'] = 'If checked, users will be allowed to select a theme when editing or creating a portfolio page. The page will be displayed to other users using the selected theme.';
$string['userscanhiderealnames'] = 'Users can hide real names';
......@@ -832,7 +834,7 @@ $string['institutionupdatedsuccessfully'] = 'Institution updated successfully.';
$string['registrationallowed'] = 'Registration allowed';
$string['registrationalloweddescription3'] = 'If checked, people can register for this institution on your site using the registration form. If registration is off, non-members cannot request membership of the institution and members cannot leave the institution or delete their user accounts themselves.';
$string['registrationconfirm'] = 'Confirm registration';
$string['registrationconfirmdescription'] = 'If checked, registration must be approved by an institution administrator.';
$string['registrationconfirmdescription1'] = 'If checked, registration must be approved by an institution administrator. If the check box is greyed out, the site administrator has forced this setting for all institutions.';
$string['defaultmembershipperiod'] = 'Default membership period';
$string['defaultmembershipperioddescription'] = 'How long new members remain associated with the institution.';
$string['showonlineusers'] = 'Show online users';
......
......@@ -145,7 +145,8 @@ if (isset($key)) {
// Else, since there are multiple, request to join
else {
if ($registration->pending == 2) {
if ($confirm = get_field('institution', 'registerconfirm', 'name', $registration->institution)) {
if (get_config('requireregistrationconfirm')
|| get_field('institution', 'registerconfirm', 'name', $registration->institution)) {
$user->join_institution($registration->institution);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment