• Resolved Torsten H?ndler

    (@shogathu)


    When creating or editing an event it’s possible to set a higher min-amount then max-amount so its possible to set 5 min and 1 max. There is no error message at saving the event.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi, EM user here too…

    Really? Hmmm, never tried that. ??
    You can add an additional validation with some custom coding, if interested. But I agree that it should’ve been built-in already. Perhaps you found a bug ??

    Thread Starter Torsten H?ndler

    (@shogathu)

    @duisterdenhaag

    Thanks for the response and I think this should be fixed, too.

    I’ve looked at the complex EM code and didn’t find any filter where I can add a custom validation to check this. So I hope that there will be an update soon

    You can use the filter ’em_event_validate_meta’. That is called just before the event post is saved to the database.

    Something like:

    function my_validate_ticket_input( $result, $EM_Event ) {
    	// Check if Bookings are enabled for this event.
    	if( $_POST['post_type'] === 'event' && $_POST['event_rsvp'] === '1' ) {
    		$EM_Tickets = $EM_Event->get_tickets();
    		foreach( $EM_Tickets as $EM_Ticket ) {
    			$min = (int) $EM_Ticket->ticket_min;
    			$max = (int) $EM_Ticket->ticket_max;
    			if( ($max < $min) || ($min > $max) ) {
    				$EM_Event->add_error("Your ticket settings are illogical.");
    				return false;
    			}
    		}
    	}
    	return;
    }
    add_filter('em_event_validate_meta', 'my_validate_ticket_input', 10, 2);

    Hi Patrick and shogathu,

    Thanks for reporting this bug. Just wanted to update that I have reported this Bug to our Developers.

    Thread Starter Torsten H?ndler

    (@shogathu)

    Hey,

    @duisterdenhaag

    thank you for the code.

    @timrv
    thank you for reporting this.

    I wish you both a nice day and a great weekend ??

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    Just letting you know that this has been fixed in the latest version of EM 5.9.6

    thanks for reporting it!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Tickets no Min/Max Check’ is closed to new replies.