hmm, can I know what are the other fields that you’ve wanted to validate?
i want to validate
if em_tickets more than 1
and there is should be something in booking_comment
currrently only email gets validated.
Have you tried checking for the strlen of $_REQUEST[‘booking_comment’] ?
http://php.net/manual/en/function.strlen.php
please see my above function
thats what i am trying to do
if ($_REQUEST['em_tickets'] > 1 && $_REQUEST['booking_comment'] == ''){
but the above function is not trigging at all
function em_validate($result, $EM_Event){
if ($_REQUEST['em_tickets'] > 1 && $_REQUEST['booking_comment'] == ''){
$EM_Event->add_error('fill more names');
$result = false;
}
return $result;
}
add_filter('em_event_validate','em_validate', 1, 2);
I have almost created the validating part, however i am not able to get the number of tickets reserved.. can someone point out an solution ?
this part is not working : $_REQUEST[’em_tickets’] > 1
This is my code:
function em_validate($result, $EM_Event){
if ($_REQUEST['em_tickets'] > 1 && $_REQUEST['booking_comment'] == ''){
$EM_Event->add_error('Fill out the comments');
$result = false;
}
return $result;
}
add_filter('em_booking_validate','em_validate', 1, 2);
try to use $EM_Event->get_bookings()->get_booked_spaces() instead of $_REQUEST['em_tickets']
eg. under classes/em-bookings.php