Forums

[Plugin: Events Manager] No fields required on RSVP form (7 posts)

  1. randyhoyt
    Member
    Posted 2 years ago #

    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.

    http://wordpress.org/extend/plugins/events-manager/

  2. randyhoyt
    Member
    Posted 2 years ago #

    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;
    }
  3. randyhoyt
    Member
    Posted 2 years ago #

    The line ...

    $bookerName != "" || $bookerEmail != ""

    ... should of course read ...

    $bookerName != "" && $bookerEmail != ""

  4. RunningSocks
    Member
    Posted 2 years ago #

    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..).

  5. manon1165
    Member
    Posted 2 years ago #

    didn't work for me. don't know what i did wrong.

  6. Franky
    Member
    Posted 1 year ago #

    I've included something similar in my version, see at the bottom of http://davidebenini.it/events-manager-forum/topic.php?id=865

  7. Franky
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic