I am trying to follow this debugging tutorial on adding custom booking form fields - Link

My intention is to add a field, which is required, that is saved amongst the other user data when they register to an event. So, should they book an event again in future, the custom field will already be filled in, like the forename, surname etc...

So far I have added my custom field to this file - event/wp-content/plugins/events-manager/templates/forms/bookingform/booking-fields.php

<label for='user_practice'><?php _e('Practice','dbem') ?></label>
<input type="text" name="user_practice" id="user_practice" class="input" value="<?php if(!empty($_REQUEST['user_practice'])) echo esc_attr($_REQUEST['user_practice']); ?>"  />

Which is outside the if statement that includes the name, phone and email:

<?php if( !is_user_logged_in() && apply_filters('em_booking_form_show_register_form',true) ): ?>

<?php endif; ?>

Half way down the support page (link above), Marcus, the plugin's author says to use the 'em_booking_validate' function. The only issue is, I'm not sure how or where to use it!

I added this to the bottom of my bookings-field page, but I've tried submitted the form and the custom data hasn't followed:

<?php if( ! empty( $_REQUEST['user_practice'] ) ){
        $EM_Booking->booking_meta['registration']['user_practice'] = wp_kses( $_REQUEST['user_practice'], array() );
    } ?>

Any guidance / support would be appreciated.

  • Anybody?! Please?! – Ben Oct 3 '13 at 15:20

You have to save them somewhere like in the em_meta table or in the booking_meta field of the booking table (stored as a serialized array, so add to it, don't replace it) and bring it up elsewhere. If you read the tutorials, you could quite easily add extra fields etc.

http://wp-events-plugin.com/tutorials/ and this may help you

  • Please add all relevant info from the link – Pieter Goosen Jun 18 '14 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.