summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-10-05 13:26:53 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-10-05 13:26:53 +0000
commit25465ee76e58a1ee0cfb3eb748dcda19c9e04977 (patch)
treef0422190fcb909eb5c07e6948a4620d34416ee56
parent0e04fbd43dcbbbfb3e3386b86e8e843de3e8c80c (diff)
downloadbrdo-25465ee76e58a1ee0cfb3eb748dcda19c9e04977.tar.gz
brdo-25465ee76e58a1ee0cfb3eb748dcda19c9e04977.tar.bz2
#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.
-rw-r--r--modules/profile/profile.module8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index fc80f53e0..0a0bf3436 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.'));
+ }
+ }
}
/**