Skip to content

Commit 92a8998

Browse files
Internal: Remove show_conditions_to_user and gdpr/my_terms extra fields
1 parent 1751fa1 commit 92a8998

File tree

7 files changed

+0
-118
lines changed

7 files changed

+0
-118
lines changed

public/main/admin/user_edit.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -372,20 +372,6 @@ function confirmation(name) {
372372
});
373373
</script>';
374374

375-
// Freeze user conditions, admin cannot updated them
376-
$extraConditions = api_get_setting('profile.show_conditions_to_user', true);
377-
378-
if ($extraConditions && isset($extraConditions['conditions'])) {
379-
$extraConditions = $extraConditions['conditions'];
380-
foreach ($extraConditions as $condition) {
381-
/** @var HTML_QuickForm_group $element */
382-
$element = $form->getElement('extra_'.$condition['variable']);
383-
if ($element) {
384-
$element->freeze();
385-
}
386-
}
387-
}
388-
389375
// Submit button
390376
$form->addButtonSave(get_lang('Save'));
391377

public/main/auth/profile.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -353,19 +353,6 @@ function show_image(image,width,height) {
353353
}
354354
// SUBMIT
355355
$form->addButtonUpdate(get_lang('Save settings'), 'apply_change');
356-
357-
// Student cannot modified their user conditions
358-
$extraConditions = api_get_setting('profile.show_conditions_to_user', true);
359-
if ($extraConditions && isset($extraConditions['conditions'])) {
360-
$extraConditions = $extraConditions['conditions'];
361-
foreach ($extraConditions as $condition) {
362-
$element = $form->getElement('extra_'.$condition['variable']);
363-
if ($element) {
364-
$element->freeze();
365-
}
366-
}
367-
}
368-
369356
$form->setDefaults($user_data);
370357

371358
$filtered_extension = false;

public/main/auth/registration.php

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -155,30 +155,6 @@
155155
);
156156
}
157157

158-
$settingConditions = api_get_setting('profile.show_conditions_to_user', true);
159-
$extraConditions = 'false' !== $settingConditions ? $settingConditions : [];
160-
if ($extraConditions && isset($extraConditions['conditions'])) {
161-
// Create user extra fields for the conditions
162-
$userExtraField = new ExtraField('user');
163-
$extraConditions = $extraConditions['conditions'];
164-
foreach ($extraConditions as $condition) {
165-
$exists = $userExtraField->get_handler_field_info_by_field_variable($condition['variable']);
166-
if (false == $exists) {
167-
$params = [
168-
'value_type' => ExtraField::FIELD_TYPE_CHECKBOX,
169-
'variable' => $condition['variable'],
170-
'display_text' => $condition['display_text'],
171-
'default_value' => '',
172-
'visible_to_self' => 0,
173-
'visible_to_others' => 0,
174-
'changeable' => 0,
175-
'filter' => 0,
176-
];
177-
$userExtraField->save($params);
178-
}
179-
}
180-
}
181-
182158
$form = new FormValidator('registration');
183159
$userAlreadyRegisteredShowTerms = false;
184160
$termRegistered = Session::read('term_and_condition');
@@ -697,33 +673,6 @@ function ($email) {
697673

698674
$course_code_redirect = Session::read('course_redirect');
699675
$sessionToRedirect = Session::read('session_redirect');
700-
701-
if ($extraConditions && $extraFieldsLoaded) {
702-
// Set conditions as "required" and also change the labels
703-
foreach ($extraConditions as $condition) {
704-
/** @var HTML_QuickForm_group $element */
705-
$element = $form->getElement('extra_'.$condition['variable']);
706-
if ($element) {
707-
$children = $element->getElements();
708-
/** @var HTML_QuickForm_checkbox $child */
709-
foreach ($children as $child) {
710-
$child->setText(get_lang($condition['display_text']));
711-
}
712-
$form->setRequired($element);
713-
if (!empty($condition['text_area'])) {
714-
$element->setLabel(
715-
[
716-
'',
717-
'<div class="form-control" disabled=disabled style="height: 100px; overflow: auto;">'.
718-
get_lang(nl2br($condition['text_area'])).
719-
'</div>',
720-
]
721-
);
722-
}
723-
}
724-
}
725-
}
726-
727676
$tpl = new Template($toolName);
728677
$textAfterRegistration = '';
729678
if ($form->validate()) {

src/CoreBundle/DataFixtures/ExtraFieldFixtures.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -378,14 +378,6 @@ public static function getExtraFields(): array
378378
'item_type' => ExtraField::USER_FIELD_TYPE,
379379
'value_type' => ExtraField::FIELD_TYPE_DATETIME,
380380
],
381-
[
382-
'variable' => 'gdpr',
383-
'display_text' => 'GDPR compliance',
384-
'item_type' => ExtraField::USER_FIELD_TYPE,
385-
'value_type' => ExtraField::FIELD_TYPE_CHECKBOX,
386-
'visible_to_self' => false,
387-
'changeable' => true,
388-
],
389381
[
390382
'variable' => 'isFromNewLogin',
391383
'display_text' => 'Is from new login',
@@ -412,14 +404,6 @@ public static function getExtraFields(): array
412404
'item_type' => ExtraField::USER_FIELD_TYPE,
413405
'value_type' => ExtraField::FIELD_TYPE_TEXT,
414406
],
415-
[
416-
'variable' => 'my_terms',
417-
'display_text' => 'My terms',
418-
'item_type' => ExtraField::USER_FIELD_TYPE,
419-
'value_type' => ExtraField::FIELD_TYPE_TEXT,
420-
'visible_to_self' => true,
421-
'changeable' => true,
422-
],
423407
[
424408
'variable' => 'new_tracking_system',
425409
'display_text' => 'Use alternate tracking system',

src/CoreBundle/DataFixtures/SettingsCurrentFixtures.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3065,11 +3065,6 @@ public static function getNewConfigurationSettings(): array
30653065
'title' => 'Send mail to admin when user created',
30663066
'comment' => 'Send email notification to admin when a user is created.',
30673067
],
3068-
[
3069-
'name' => 'show_conditions_to_user',
3070-
'title' => 'Show specific registration conditions',
3071-
'comment' => "Show multiple conditions to user during sign up process. Provide an array with each element containing 'variable' (internal extra field name), 'display_text' (simple text for a checkbox), 'text_area' (long text of conditions).",
3072-
],
30733068
[
30743069
'name' => 'user_import_settings',
30753070
'title' => 'Options for user import',

src/CoreBundle/DataFixtures/SettingsValueTemplateFixtures.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -519,23 +519,6 @@ public static function getTemplatesGrouped(): array
519519
'admins' => [1],
520520
],
521521
],
522-
[
523-
'variable' => 'show_conditions_to_user',
524-
'json_example' => [
525-
'conditions' => [
526-
[
527-
'variable' => 'gdpr',
528-
'display_text' => 'GDPRTitle',
529-
'text_area' => 'GDPRTextArea',
530-
],
531-
[
532-
'variable' => 'my_terms',
533-
'display_text' => 'My test conditions',
534-
'text_area' => 'This is a long text area, with lot of terms and conditions ... ',
535-
],
536-
],
537-
],
538-
],
539522
[
540523
'variable' => 'profile_fields_visibility',
541524
'json_example' => [

src/CoreBundle/Settings/ProfileSettingsSchema.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public function buildSettings(AbstractSettingsBuilder $builder): void
4747
'data_protection_officer_email' => '',
4848
'hide_user_field_from_list' => '',
4949
'send_notification_when_user_added' => '',
50-
'show_conditions_to_user' => '',
5150
'allow_teachers_to_classes' => 'false',
5251
'profile_fields_visibility' => '',
5352
'user_import_settings' => '',
@@ -131,7 +130,6 @@ public function buildForm(FormBuilderInterface $builder): void
131130
->add('data_protection_officer_email', TextType::class)
132131
->add('hide_user_field_from_list', TextareaType::class)
133132
->add('send_notification_when_user_added', TextareaType::class)
134-
->add('show_conditions_to_user', TextareaType::class)
135133
->add('allow_teachers_to_classes', YesNoType::class)
136134
->add('profile_fields_visibility', TextareaType::class)
137135
->add('user_import_settings', TextareaType::class)

0 commit comments

Comments
 (0)