From 7e6b59707d7e50f32742f68f2dcf3281eaaeebb3 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Wed, 18 Mar 2015 12:09:50 +1100 Subject: [PATCH] Provide option to disable maximum age check --- booking.admin.inc | 10 +++++++++- booking.regn_form.inc | 6 +++--- booking.regn_node.inc | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/booking.admin.inc b/booking.admin.inc index c4f9111..810ecb9 100644 --- a/booking.admin.inc +++ b/booking.admin.inc @@ -80,11 +80,19 @@ function booking_admin() { '#date_label_position' => 'within', '#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', diff --git a/booking.regn_form.inc b/booking.regn_form.inc index b91195d..d7d74a1 100644 --- a/booking.regn_form.inc +++ b/booking.regn_form.inc @@ -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; } diff --git a/booking.regn_node.inc b/booking.regn_node.inc index 5f87050..7b2e0ad 100644 --- a/booking.regn_node.inc +++ b/booking.regn_node.inc @@ -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 }