MDL-66994 core: Remove display contact form setting in site registration

Removing the display of the contact form causes deprecation of some
language strings and unsets the site_contactable during the upgrade.
This commit is contained in:
meirzamoodle 2024-06-27 17:40:27 +07:00
parent 5aef789ac6
commit 1f1d1a3920
7 changed files with 20 additions and 17 deletions

View file

@ -116,3 +116,7 @@ coursecalendar,core_calendar
importcalendarexternal,core_calendar importcalendarexternal,core_calendar
nocalendarsubscriptions,core_calendar nocalendarsubscriptions,core_calendar
datechanged,core datechanged,core
siteregistrationcontact,core_hub
siteregistrationcontact_help,core_hub
registrationcontactno,core
registrationcontactyes,core

View file

@ -150,8 +150,6 @@ $string['siteprivacy_help'] = 'You can choose to have your site listed publicly
$string['siteprivacynotpublished'] = 'Do not list my site'; $string['siteprivacynotpublished'] = 'Do not list my site';
$string['siteprivacypublished'] = 'Only display my site name'; $string['siteprivacypublished'] = 'Only display my site name';
$string['siteprivacylinked'] = 'Display my site name with the link'; $string['siteprivacylinked'] = 'Display my site name with the link';
$string['siteregistrationcontact'] = 'Display contact form';
$string['siteregistrationcontact_help'] = 'If you allow it, other people in our Moodle community (who need a login account) can contact you via a form on our Moodle community site. However, they will never be able to see your email address.';
$string['siteregistrationemail'] = 'Notifications of new Moodle releases, security alerts and other important news'; $string['siteregistrationemail'] = 'Notifications of new Moodle releases, security alerts and other important news';
$string['siteregistrationemail_help'] = 'You have the option of subscribing to our low-volume mailing list for notifications of new Moodle releases, security alerts and other important news. You may unsubscribe at any time.'; $string['siteregistrationemail_help'] = 'You have the option of subscribing to our low-volume mailing list for notifications of new Moodle releases, security alerts and other important news. You may unsubscribe at any time.';
$string['siteregistrationupdated'] = 'Site registration updated'; $string['siteregistrationupdated'] = 'Site registration updated';
@ -178,3 +176,7 @@ $string['wrongtoken'] = 'The registration failed for some unknown reason (networ
// Deprecate since 3.11. // Deprecate since 3.11.
$string['sitecommnewsno'] = 'No, I do not wish to receive any emails'; $string['sitecommnewsno'] = 'No, I do not wish to receive any emails';
// Deprecated since 4.5.
$string['siteregistrationcontact'] = 'Display contact form';
$string['siteregistrationcontact_help'] = 'If you allow it, other people in our Moodle community (who need a login account) can contact you via a form on our Moodle community site. However, they will never be able to see your email address.';

View file

@ -1816,8 +1816,6 @@ $string['refresh'] = 'Refresh';
$string['refreshingevents'] = 'Refreshing events'; $string['refreshingevents'] = 'Refreshing events';
$string['registration'] = 'Moodle registration'; $string['registration'] = 'Moodle registration';
$string['registrationcontact'] = 'Contact from the public'; $string['registrationcontact'] = 'Contact from the public';
$string['registrationcontactno'] = 'No, I do not want to be contacted by other people';
$string['registrationcontactyes'] = 'Yes, provide a form for other Moodlers to contact me';
$string['registrationemail'] = 'Email notifications'; $string['registrationemail'] = 'Email notifications';
$string['registrationinfo'] = '<p>This page allows you to register your Moodle site with moodle.org. Registration is free. $string['registrationinfo'] = '<p>This page allows you to register your Moodle site with moodle.org. Registration is free.
The main benefit of registering is that you will be added to a low-volume mailing list The main benefit of registering is that you will be added to a low-volume mailing list
@ -2522,3 +2520,5 @@ $string['coursesearch_help'] = 'You can search for multiple words at once and ca
// Deprecated since Moodle 4.5. // Deprecated since Moodle 4.5.
$string['datechanged'] = 'Date changed'; $string['datechanged'] = 'Date changed';
$string['registrationcontactno'] = 'No, I do not want to be contacted by other people';
$string['registrationcontactyes'] = 'Yes, provide a form for other Moodlers to contact me';

View file

@ -43,7 +43,7 @@ class registration {
/** @var array Fields used in a site registration form. /** @var array Fields used in a site registration form.
* IMPORTANT: any new fields with non-empty defaults have to be added to CONFIRM_NEW_FIELDS */ * IMPORTANT: any new fields with non-empty defaults have to be added to CONFIRM_NEW_FIELDS */
const FORM_FIELDS = ['policyagreed', 'language', 'countrycode', 'privacy', const FORM_FIELDS = ['policyagreed', 'language', 'countrycode', 'privacy',
'contactemail', 'contactable', 'emailalert', 'emailalertemail', 'commnews', 'commnewsemail', 'contactemail', 'emailalert', 'emailalertemail', 'commnews', 'commnewsemail',
'contactname', 'name', 'description', 'imageurl', 'contactphone', 'regioncode', 'geolocation', 'street']; 'contactname', 'name', 'description', 'imageurl', 'contactphone', 'regioncode', 'geolocation', 'street'];
/** @var array List of new FORM_FIELDS or siteinfo fields added indexed by the version when they were added. /** @var array List of new FORM_FIELDS or siteinfo fields added indexed by the version when they were added.

View file

@ -129,15 +129,6 @@ class site_registration_form extends \moodleform {
$mform->setType('contactemail', PARAM_EMAIL); $mform->setType('contactemail', PARAM_EMAIL);
$mform->addHelpButton('contactemail', 'siteemail', 'hub'); $mform->addHelpButton('contactemail', 'siteemail', 'hub');
$options = array();
$options[0] = get_string("registrationcontactno");
$options[1] = get_string("registrationcontactyes");
$mform->addElement('select', 'contactable', get_string('siteregistrationcontact', 'hub'), $options);
$mform->setType('contactable', PARAM_INT);
$mform->addHelpButton('contactable', 'siteregistrationcontact', 'hub');
$mform->hideIf('contactable', 'privacy', 'eq', registration::HUB_SITENOTPUBLISHED);
unset($options);
$this->add_checkbox_with_email('emailalert', 'siteregistrationemail', false, get_string('registrationyes')); $this->add_checkbox_with_email('emailalert', 'siteregistrationemail', false, get_string('registrationyes'));
$this->add_checkbox_with_email( $this->add_checkbox_with_email(
@ -300,8 +291,6 @@ class site_registration_form extends \moodleform {
$data->commnewsemail = null; $data->commnewsemail = null;
} }
unset($data->commnewsnewemail); unset($data->commnewsnewemail);
// Always return 'contactable'.
$data->contactable = empty($data->contactable) ? 0 : 1;
if (debugging('', DEBUG_DEVELOPER)) { if (debugging('', DEBUG_DEVELOPER)) {
// Display debugging message for developers who added fields to the form and forgot to add them to registration::FORM_FIELDS. // Display debugging message for developers who added fields to the form and forgot to add them to registration::FORM_FIELDS.

View file

@ -1167,6 +1167,14 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2024041200.00); upgrade_main_savepoint(true, 2024041200.00);
} }
if ($oldversion < 2024062700.01) {
// Remove the site_contactable config of the hub plugin from config plugin table.
unset_config('site_contactable', 'hub');
// Main savepoint reached.
upgrade_main_savepoint(true, 2024062700.01);
}
// Automatically generated Moodle v4.4.0 release upgrade line. // Automatically generated Moodle v4.4.0 release upgrade line.
// Put any upgrade step following this. // Put any upgrade step following this.

View file

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$version = 2024062700.00; // YYYYMMDD = weekly release date of this DEV branch. $version = 2024062700.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches. // RR = release increments - 00 in DEV branches.
// .XX = incremental changes. // .XX = incremental changes.
$release = '4.5dev (Build: 20240627)'; // Human-friendly version name $release = '4.5dev (Build: 20240627)'; // Human-friendly version name