When adding a booking through the RSVP form, the code does not check to see if any of the fields are populated. I would think Name and Email would be required.
When adding a booking through the RSVP form, the code does not check to see if any of the fields are populated. I would think Name and Email would be required.
I modified the dbem_book_seats() function in dbem_rsvp.php like as follows, and it seems to work fine:
function dbem_book_seats() {
$bookerName = dbem_sanitize_request($_POST['bookerName']);
$bookerEmail = dbem_sanitize_request($_POST['bookerEmail']);
$bookerPhone = dbem_sanitize_request($_POST['bookerPhone']);
$bookedSeats = dbem_sanitize_request($_POST['bookedSeats']);
$bookerComment = dbem_sanitize_request($_POST['bookerComment']);
$event_id = dbem_sanitize_request($_GET['event_id']);
if ($bookerName != "" || $bookerEmail != "") { // added this line
// added this line
$booker = dbem_get_person_by_name_and_email($bookerName, $bookerEmail);
if (!$booker) {
$booker = dbem_add_person($bookerName, $bookerEmail, $bookerPhone);
}
if (dbem_are_seats_available_for($event_id, $bookedSeats)) {
dbem_record_booking($event_id, $booker['person_id'], $bookedSeats,$bookerComment);
$result = __('Your booking has been recorded','dbem');
$mailing_is_active = get_option('dbem_rsvp_mail_notify_is_active');
if($mailing_is_active) {
dbem_email_rsvp_booking();
}
} else {
$result = __('Booking cannot be made – not enough seats available!', 'dbem');
}
// added this line
} else { // added this line
$result = __('Name and email are required to RSVP for this event.', 'dbem'); // added this line
} // added this line
// added this line
// added this line
return $result;
}The line ...
$bookerName != "" || $bookerEmail != ""
... should of course read ...
$bookerName != "" && $bookerEmail != ""
Jep, works fine for me. but could you mark in booking form the required fields by displaying a "*" or text "required"?
will hope this feature is included in next release (settings page, where everyone an decide, which are the the required fields), also spam protect (captcha..).
didn't work for me. don't know what i did wrong.
I've included something similar in my version, see at the bottom of http://davidebenini.it/events-manager-forum/topic.php?id=865
I've also added a captcha check to the rsvp form, see at the bottom of http://davidebenini.it/events-manager-forum/topic.php?id=865
This topic has been closed to new replies.