Provide option to disable maximum age check
This commit is contained in:
@@ -81,10 +81,18 @@ function booking_admin() {
|
||||
'#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 (
|
||||
'#type' => 'date_select',
|
||||
'#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'),
|
||||
'#date_format' => 'd/m/Y',
|
||||
'#date_label_position' => 'within',
|
||||
|
@@ -145,12 +145,12 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
|
||||
'#required' => TRUE,
|
||||
'#date_format' => 'd/m/Y',
|
||||
'#date_label_position' => 'within',
|
||||
'#date_year_range' => '-50:-13'
|
||||
'#date_year_range' => '-60:-10'
|
||||
//'#date_year_range' => $date_year_range,
|
||||
);
|
||||
|
||||
//override our generous date year range if this is a new form submission
|
||||
if ($inserting == TRUE) {
|
||||
//override our generous date year range if this is a new form submission and that feature is enabled
|
||||
if ($inserting == TRUE && variable_get('booking_enable_min_age_restriction', 1) == 1) {
|
||||
$form['your-details']['booking_dob']['#date_year_range'] = $date_year_range;
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user