From 25465ee76e58a1ee0cfb3eb748dcda19c9e04977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Fri, 5 Oct 2007 13:26:53 +0000 Subject: [PATCH] #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. --- modules/profile/profile.module | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/profile/profile.module b/modules/profile/profile.module index fc80f53e0d7..0a0bf343688 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -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.')); + } + } } /**