Provide option to disable maximum age check

This commit is contained in:
2015-03-18 12:09:50 +11:00
parent 5aa285e9dc
commit 7e6b59707d
3 changed files with 13 additions and 5 deletions

View File

@@ -81,10 +81,18 @@ function booking_admin() {
'#date_year_range' => '-60:-10' '#date_year_range' => '-60:-10'
); );
$form['attendee']['booking_enable_min_age_restriction'] = array (
'#type' => 'radios',
'#title' => t('Enable old age restriction?'),
'#description' => t('Set this to Yes if you wish to prevent people over the age defined below from registering.'),
'#options' => array (0 => t('No'), t('Yes')),
'#default_value' => variable_get('booking_enable_min_age_restriction', 1),
);
$form['attendee']['booking_min_dob'] = array ( $form['attendee']['booking_min_dob'] = array (
'#type' => 'date_select', '#type' => 'date_select',
'#title' => t('Minimum Date of Birth'), '#title' => t('Minimum Date of Birth'),
'#description' => t("The oldest date of birth you wish to allow into the event."), '#description' => t("The oldest date of birth you wish to allow into the event. Note that only the year is taken into account."),
'#default_value' => variable_get('booking_min_dob','1995-04-15 00:00:00'), '#default_value' => variable_get('booking_min_dob','1995-04-15 00:00:00'),
'#date_format' => 'd/m/Y', '#date_format' => 'd/m/Y',
'#date_label_position' => 'within', '#date_label_position' => 'within',

View File

@@ -145,12 +145,12 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#required' => TRUE, '#required' => TRUE,
'#date_format' => 'd/m/Y', '#date_format' => 'd/m/Y',
'#date_label_position' => 'within', '#date_label_position' => 'within',
'#date_year_range' => '-50:-13' '#date_year_range' => '-60:-10'
//'#date_year_range' => $date_year_range, //'#date_year_range' => $date_year_range,
); );
//override our generous date year range if this is a new form submission //override our generous date year range if this is a new form submission and that feature is enabled
if ($inserting == TRUE) { if ($inserting == TRUE && variable_get('booking_enable_min_age_restriction', 1) == 1) {
$form['your-details']['booking_dob']['#date_year_range'] = $date_year_range; $form['your-details']['booking_dob']['#date_year_range'] = $date_year_range;
} }

View File

@@ -114,7 +114,7 @@ function booking_load($nodes) {
} }
} }
watchdog('booking', 'Final loaded node: @info', array('@info' => var_export($nodes, TRUE))); //watchdog('booking', 'Final loaded node: @info', array('@info' => var_export($nodes, TRUE)));
// no return necessary since $nodes array members reference objects global to this function // no return necessary since $nodes array members reference objects global to this function
} }