Title: again #_BOOKINGBUTTON
Last modified: August 20, 2016

---

# again #_BOOKINGBUTTON

 *  Resolved [friedhelm](https://wordpress.org/support/users/friedhelm/)
 * (@friedhelm)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/again-_bookingbutton/)
 * dear forum
 * if the user is logged in and booked the last ticket, the logged in user cant 
   cancel the booking because there will be no cancel button..
 * but we need one, is there a posibility? (a _Cancelbutton ?)
 * dokumentation:
    “A single button that will appear to logged in users, if they
   click on it, they apply for a booking. This button will only display if there
   is one ticket.”
 * thanks a lot
 * [http://wordpress.org/extend/plugins/events-manager/](http://wordpress.org/extend/plugins/events-manager/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Marcus (aka @msykes)](https://wordpress.org/support/users/netweblogic/)
 * (@netweblogic)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/again-_bookingbutton/#post-3397263)
 * if they visit the events/my-bookings page (or similar if you renamed it), do 
   they see a link to cancel?
 * Also, do you have the option to allow users to cancel in your Events > Settings
   > Bookings > General Options?
 *  Thread Starter [friedhelm](https://wordpress.org/support/users/friedhelm/)
 * (@friedhelm)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/again-_bookingbutton/#post-3397304)
 * [here](http://www.sports-and-health.de/siebentage/testkurs/) is the link for 
   our bookingpage, i made it as a template.
 * in the original bookingbutton.php there is only a message that the course full
   is, no possibility to cancel the course for a loggedin user, so i tried this:
 * the last few lines in the script:
 *     ```
       <?php elseif( $EM_Event->get_bookings()->get_available_spaces() <= 0 ): ?>
       <?php $Current_user_booking_id = $EM_Event->get_bookings()->has_booking(get_current_user_id())->booking_id; ?>
       <?php //echo ($Current_user_booking_id) ?>
       <a id="em-cancel-button_<?php echo $Current_user_booking_id; ?>_<?php echo wp_create_nonce('booking_cancel'); ?>" class="button em-cancel-button"><?php echo $button_cancel; ?></a>
       <span class="em-full-button"><?php //echo $notice_full ?></span>
       <?php endif; ?>
       ```
   
 * ps: i hope i found the right “backticks”
 *  Plugin Author [Marcus (aka @msykes)](https://wordpress.org/support/users/netweblogic/)
 * (@netweblogic)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/again-_bookingbutton/#post-3397397)
 * I get redirected to your homepage, so I don’t see the buttons on your site.
 * however, are you sure you’re using an up-to-date version of EM? Looking into 
   this we do have a cancel button and have had it for a while now.
 * If booked, it should show up as a cancel button, provided you enable cancellations
   in your Settings > Bookings > General Options
 *  Thread Starter [friedhelm](https://wordpress.org/support/users/friedhelm/)
 * (@friedhelm)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/again-_bookingbutton/#post-3397441)
 * here are my settings:
 * 1. settings > bookings > general Options >Can users cancel their booking? > yes.
   
   2. settings > bookings > general Options >Allow double bookings? > no.
 * i am using version em Version 5.3.5,
    emp Version 2.2.8.
 * i made a testcourse with two spaces and reserved this course with two different
   logged-in customers.
 * if the last customer loggs in and tries to canel his course he gets the message:“
   Sold Out” but no cancel-button.
 * in my template i use `$EM_Event->output('#_BOOKINGBUTTON')`, so i think this 
   calls the “bookingbutton.php”.
 * therefore i copied the file “bookingbutton.php” from its originalplace in
    plug-
   ins/events-manager/templates/placeholders to: mytheme/plug-ins/events-manager/
   placeholders.
 * in “bookingbutton.php” i found in line 31 `<?php echo $notice_full ?>` witch 
   gives me the “Sold Out” message.
 * but in my case it should go to line 25 `<?php echo $button_cancel; ?>`to give
   me the cancel-button. here the scripts looks for double-booking (dbem_bookings_double)
   and if the user is allowed to cancel bookings (dbem_bookings_user_cancellation),
   but i dont know what `$EM_Booking->status != 3`means?
 * so i commented line 31 out and tried to find out if the logged-in user has a 
   corresponding booking_id (even the course is fully booked):
 * `<?php $Current_user_booking_id = $EM_Event->get_bookings()->has_booking(get_current_user_id())-
   >booking_id; ?>`
 * and if so show a cancel-button:
 *     ```
       <?php if ($Current_user_booking_id) : ?>
       <a id="em-cancel-button_<?php echo $EM_Booking->booking_id; ?>_<?php echo wp_create_nonce('booking_cancel'); ?>" class="button em-cancel-button"><?php echo $button_cancel; ?></a>
       <?php else: ?>
       <span class="em-full-button"><?php echo $notice_full ?></span>
       <?php endif; ?>
       ```
   
 * this work for me, but i think it could be made between line 24 and 26?
 * thanks a lot !
 *  Thread Starter [friedhelm](https://wordpress.org/support/users/friedhelm/)
 * (@friedhelm)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/again-_bookingbutton/#post-3397452)
 * sorry, there is a little mistake in the script:
 * instead of $EM_Booking->booking_id it should be $Current_user_booking_id!
 *     ```
       <?php if ($Current_user_booking_id) : ?>
       <a id="em-cancel-button_<?php echo $Current_user_booking_id; ?>_<?php echo wp_create_nonce('booking_cancel'); ?>" class="button em-cancel-button"><?php echo $button_cancel; ?></a>
       <?php else: ?>
       <span class="em-full-button"><?php echo $notice_full ?></span>
       <?php endif; ?>
       ```
   
 *  Plugin Author [Marcus (aka @msykes)](https://wordpress.org/support/users/netweblogic/)
 * (@netweblogic)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/again-_bookingbutton/#post-3397467)
 * i see what you mean, if the event is fully booked it always skips to the fully
   booked message regardless of whether the user booked or not.
 * will fix asap.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘again #_BOOKINGBUTTON’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=1039078)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Marcus (aka @msykes)](https://wordpress.org/support/users/netweblogic/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/again-_bookingbutton/#post-3397467)
 * Status: resolved