WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Custom booking form in code (15 posts)

  1. Patrick Hesselberg
    Member
    Posted 2 years ago #

    Heya,

    As I need more fields in my booking/singup form I edited the booking-fields.php file and added my new fields.

    What do I need to do to save these fields and export them afterwards? As I do not use the pro version, I know I will have to make the changes directly in the code.

    Thanks
    Compute

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

  2. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    pro hooks into the actions and filters in the EM plugin. remember that Pro is an add-on too, so no hacking is needed on your part either.

    note that pro does all this out the box with a form editor.

  3. Patrick Hesselberg
    Member
    Posted 2 years ago #

    As I'm not using pro im wondering how to do this from my own functions.php

  4. Patrick Hesselberg
    Member
    Posted 2 years ago #

    Finally!

    Added my fields in booking-fields.php

    Hooked into em_booking_add saved my field

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

    Will now also be saved :)
    I'm still trying to add some validation to my custom fields if anyone knows what/how to hook that?

  5. adzay
    Member
    Posted 1 year ago #

    Hi Compute,

    Is 'Company' your custom field? How did you add them?

    I have been looking for help on this for a long time.

  6. agelonwl
    Member
    Posted 1 year ago #

    hi @adzay

    custom booking form is available to pro versions only - http://wp-events-plugin.com/documentation/custom-booking-forms/

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    @Compute, you could try hooking into em_booking_validate

  8. Patrick Hesselberg
    Member
    Posted 1 year ago #

    Sorry I never closed this thread.
    As Marcus said, hook into em_booking_validate and it'll Work.

  9. adzay
    Member
    Posted 1 year ago #

    I want to buy Pro. Is there a guarantee that the form editor will work with custom fields that I have created using the plugin "Advanced custom fields" ?

    And that I will be able to re-order them?

    Thanks

  10. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    We can't guarantee that it'll work with every plugin, however as far as I'm aware the only issue with ACF are related to event/location custom fields. Haven't heard of issues with the booking forms.

    That said, our user fields interact with the wp_users database, so any plugin storing information on there in a plaintext method should be able to be used with ours. You can reorder fields in the booking form.

  11. adzay
    Member
    Posted 1 year ago #

    Hi Marcus,

    That's unfortunate, because I need it to give my users the ability to create events/Locations. The issues that others had, were there any workarounds?

  12. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    at the moment none I'm aware of, but you can already test that out with the free version, since Pro doesn't mess with event/loaction custom fields, that's part of the main/free plugin

  13. adzay
    Member
    Posted 1 year ago #

    Dang, thanks for telling me that. That was the main reason why I wanted to purchase the pro version today ( I will soon though, when my site is ready to make booking payments).

    I've seen on other posts you guys have been a bit reluctant on teaching people about hooks ( I know its a burden to teach people things online) .But seeing as learning is my only option, is there any chance of you guys dropping ONE example of a Full hook ( not just "em_booking_validate") for a field. I just need One example piece of code then Ill know where to go.

    Computes code below.

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

    It doesn't help me because it doesn't mention em_booking_add at all. If i can have a repost of that code including em_booking_add, I'm definitely sure how to apply it to em_event_save.

    All will be good. :)

    Thanks

    Please tell me if you think I should make this into a new post.

  14. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    happy to give pointers, but we can't exactly write a long snippet for each question/situation :)

    in this case, if you don't want to use pro fields, see our tutorials for an example of how we hook into saving event stuff with pro (http://wp-events-plugin.com/tutorials/), and then apply the snippet above in combination with using the similar filters in the file classes/em-booking.php

    e.g.

    em_booking_get_post - get the custom field, add it to the booking_meta as above
    em_booking_validate - validate the field if needed

    it saves automatically, but to retreive information you may need to hook in elsewhere.

  15. marilena6
    Member
    Posted 1 year ago #

    Hello. I'm trying to add 2 custom fields to my booking form (RPrice and RSpaces, R stands for reduced tickets). So I want my current booking form with the fields "Ticket Type", "Price" and "Spaces" to have these other two as well. I've managed to add RPRice, by making several changes, but my problem is the value isn't saved when I edit the ticket. It shows by default 0.00 Euros, unless I go to the localhost database and change the value.

    Can anyone please help me with this, I'm a newbie programmer and I'm doing my thesis, and it's very important for me to make this work.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic