Skip to content
Snippets Groups Projects
Commit 25465ee7 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#176503 by chx and bennybobw: hidden profile fields cannot be required and...

#176503 by chx and bennybobw: hidden profile fields cannot be required and cannot be put on the registration form, so we needed warnings on the editing form to not let admins save forms set with these combinations.
parent 0e04fbd4
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -369,6 +369,14 @@ function profile_field_form_validate($form, &$form_state) { ...@@ -369,6 +369,14 @@ function profile_field_form_validate($form, &$form_state) {
if (db_result(db_query("SELECT fid FROM {profile_fields} WHERE name = '%s'". $query_suffix, $args2))) { if (db_result(db_query("SELECT fid FROM {profile_fields} WHERE name = '%s'". $query_suffix, $args2))) {
form_set_error('name', t('The specified name is already in use.')); form_set_error('name', t('The specified name is already in use.'));
} }
if ($form_state['values']['visibility'] == PROFILE_HIDDEN) {
if ($form_state['values']['required']) {
form_set_error('required', t('A hidden field cannot be required.'));
}
if ($form_state['values']['register']) {
form_set_error('register', t('A hidden field cannot be set to visible on the user registration form.'));
}
}
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment