
Daniel Cooksey
Hi
Is it possible to apply a discount to a ticket via a dropdown in the booking form ?
The event is a netball clinic and there are 10 spaces each at offense, mid and defense, but I would also like to set up a sibling discount, ie $10 discount for first sibling, $20 for second etc. Also is it possible to change the ticket selection table to a dropdown as only one ticket is purchased per registration form.
The way I would like it to work is that they select the playing position via a dropdown and then they select a sibling discount via another dropdown before being directed to Paypal for payment.
Regards
Daniel

Daniel Cooksey
Hi
I am getting a PHP warning if the “Terms and Conditions” checkbox is not selected when making a booking. It is set to required.
The warning is “Warning: trim() expects parameter 1 to be string, array given in /home/pivotnetballcom/public_html/wp-includes/query.php on line 1609”.
The booking is not completed and you are returned to a blank booking form page.
Regards
Daniel

Stephen Harris
That’s true, it only orders by booking date currently.
I’m afraid you’d need to role your own solution here.
One (minor) complication is that you can have multiple bookings for one event. So you may want to decide how you handle that. Cancel all bookings? Or have a cancel link for each booking.
Below is an example of how to handle the latter. If doing the former, you would pass an event ID (and occurrence ID if booking by date) and find the user’s bookings for that event (or occurrence) and cancel them all.
Simply create a link of the form:
yoursite.com?booking_id=<booking-id>&booking_action=cancel&nonce=<nonce>
Then use template_redirect
to listen such a url being hit. Then validate the user, and perform the cancellation. You’ll then need to decide where to redirect the user (i.e. redirect them to a confirmation page).
You could do something a bit more complicated by using session tokens and listen the booking(s) they’ve just cancelled, but that’s a bit beyond the scope here.
add_action( 'template_redirect', function() {
//Check the url is the one we're targetting
if ( empty( $_GET['booking_id'] ) || empty( $_GET['nonce'] ) || empty( $_GET['booking_action'] ) ) {
return;
}
if ( 'cancel' !== $_GET['booking_action'] ) {
return;
}
//Check the user is logged-in
if ( ! user_logged_in() ) {
wp_die( 'You must log-in to cancel bookings' );
}
$booking_id = (int) $_GET['booking_id'];
$nonce = $_GET['nonce'];
//Check user is authorised to cancel this booking (i.e. is the bookee);
if ( get_current_user_id() !== eo_get_booking_meta( $booking_id, 'bookee' ) ) {
wp_die( 'You do not have permission to cancel this booking' );
}
//Check the nonce
if( ! wp_verify_nonce( $nonce, 'cancel_booking' ) ) {
wp_die( 'You are not authorised to cancel this booking' );
}
//Finally cancel the booking and redirect the user.
eo_cancel_booking( $booking_id );
wp_redirect( 'yoursite.com/redirect/to/page' );
exit;
} );
It’s very much a ‘proof of concept’, but I hope it helps! You may also want to improve the way errors are handled.
-
This reply was modified 8 years, 8 months ago by
Stephen Harris.

CAS A/S Camilla Nielsen
Hi – something is wrong – can you tell me what?
add_filter( 'eventorganiser_booking_form_form_display_notices', 'my_booking_form_notices', 10, 2 ); function my_booking_form_notices( $notices, $booking_form_view ) {
//Change the logged-in notice to use display name rather than e-mail if ( isset( $notices['logged-in'] ) ) { $current_user = wp_get_current_user(); $notices['logged-in'] = sprintf( __( 'Du er logget ind og bestiller som %s (%s)', 'eventorganiserp' ), esc_attr( $current_user->display_name ), esc_attr( $current_user->user_email ) ); }
//Remove the prior booking notice:
unset( $notices['prior-booking'] );
//Remove the prior booking notice:
//unset( $notices['logged-in'] );
return $notices; }
-
This reply was modified 8 years, 8 months ago by
CAS A/S Camilla Nielsen.

Stephen Harris
Hi Camilla,
That is for FES extension. For Pro you’ll want ot use the eventorganiser_booking_form_form_display_notices
filter instead.

Stephen Harris
Hi Paksha,
By default the user is returned to the booking form with an appropriate error message if no tickets are selected (see http://demo.wp-event-organiser.com/events/event/fortnightly-event/ for instance). What behaviour are you seeing? Is the user returned to the booking form? Have you edited any of the templates, or otherwise modified the behaviour of the plug-in?
Equally, if a user tries to create an account with an e-mail address that already exists, the booking does not proceed, and they are returned to the booking form with an error message.
Regarding the payment gateway, there is no UI to set a ‘failure’ URL, but PayPal allows you to set a cancel url (a page to which the user is directed to if they cancel the checkout).
add_filter( 'eventorganiser_pre_gateway_checkout_paypal', function( $paypal_cart ) {
$paypal_cart['cancel_return'] = '...'; //URL to return to here
return $paypal_cart;
} );

Stefaan Van Hoeck
Dear Stephen,
( The url of the event is : http://toerismevosselaar.be/events/event/kersttocht-2016/ )
A other issue about the price column. The event is free but in the mail ” %tickets% ” there is a price column.
In the Reservation Form I have add a “Total” field with ID nr. 14 for Children under 12j.
Is it possible that it is also in the mail. I have try with %event_ID:14%.
I post here what I have done in the e-mail template. (Settings > Event Organiser > Tab Booking.
Beste %display_name%, uw heeft voor ” %event_title% ” op %event_date% – %ticket_quantity% – plaats(en) gereserveerd en is/zijn:
%tickets%
De reservering van je ticket is %booking_reference%
Vanaf 12 j betaalt u €3 per ticket ter plaatse aan de kassa. Gelieve gepast te betalen.
Toerisme Vosselaar vzw dankt u.
The receiver mail is like this screen picture. We will not see the price column is that possible ?
In this example of booking there are 6 tickets for 17:15u and 5 for 17:45u
Stefaan.


Joy Nanda
Hi, can you help me get the booking form out of the testimonials in the right sidebar: https://michaelmirdad.com/events/consciously-co-creating-a-new-life-online-intensive/
This is happening for any event with tickets. We use the “Easy Testimonials” plugin and somehow they get scrambled together.
I followed the steps to ‘remove the sidebar’ in EO but apparently that is not the problem.
Thank you, Joy

Stephen Harris
Hi Paksha,
Apologies for the delay in getting back to you on this.
It is currently in event-organiser-pro/includes/form-customiser/class-eo-booking-form.php
line 295.
There’s currently no documentation on this in the codex which is in the process of being migrated to a new server, and updated in the process.

Paksha Thullner
Hi,
I found the solution. The problem is that add_action has only 1 argument by default. So I changed it to 2.
add_action( ‘eventorganiser_booking_form_saved’, ‘my_form_saved_callback’, 10, 2 );

Paksha Thullner
Hi,
I have tried adding custom user information to the database like here
however the $booking_id keeps missing. Giving me the following problem:
Missing argument 2 for my_form_saved_callback() in ..\functions.php on line 320.
Which then off course doesn’t work.
I have tried debugging, but I’m not able to find a solution.

Paksha Thullner
I’m assuming that a should add the code to my themes functions.php.
However I cant find the hook function you suggested in the plugins (normal and pro):
eventorganiser_booking_form_saved
Is the current saving done with a different function?

Stephen Harris
Hi Alan,
The log-in should be on the same page as the booking form. Admittedly, if the user gets the log-in wrong they will be returned to the WP login page. (Is this what you mean?).
The easiest solution would be to set up a redirect from the WP login page to the desired page. Would that be a suitable solution for you?

ccnetadmin
Is it possible to change the login page used when users click the login option on the event booking page? Currently it takes users to the WP-Login, my site uses Ultimate Member to manage users and the WP login is blocked, I need to send them to the UM login page – *************.net/login

Stephen Harris
Hi,
The plug-in doesn’t produce the message ‘Bookings is closed for this event’, however similar such messages can be changed – so it maybe that you’ve changed the original text.
Anyway, I suspect that message refers to one of two messages that might appear in place of the booking form:
Firstly, Bookings are no longer available for this event, this appears after the last occurrence of an event has started. You would not expect this message to appear intermittently, unless you are editing the events and extending its dates.
Or This event has sold out – this appears if there are not tickets currently available (i.e they have sold out or are not yet on sale). If you have tickets coming on sale at various times it’s possible that this message displays intermittently.