Commit 25465ee7 authored by Gábor Hojtsy's avatar Gábor Hojtsy

#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
......@@ -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))) {
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.'));
}
}
}
/**
......
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