Support » Plugin: WP BASE Booking of Appointments, Services and Events » Hooks and filters for booking completion

  • Resolved siddheshsj

    (@siddheshsj)


    Hi,

    Thank you for this amazing plugin. It works like a charm. I was wondering if i can check and execute my code once user submits the entry on frontend and even for admin once booking is done. Basically that hook should give output of booking ID and status of booking when submitted.

    Can you advise?
    Thanks in advance,

    Siddhesh

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Hakan Ozevin

    (@puckrobin)

    Hi Siddesh,

    Thanks you for your nice words.

    app_new_appointment is the name of the hook you are asking. For example:


    add_action( 'app_new_appointment', 'check_my_code' );
    function check_my_code( $booking_id ) {
    $booking = new WpB_Booking( $booking_id );
    // Now $booking has all the methods you need, e.g. $booking->get_status() returns status
    }

    You can check /includes/class.booking.php file to see the available properties and methods.

    Cheers,
    Hakan

    siddheshsj

    (@siddheshsj)

    Thanks for instant reply.
    I got what i was looking for.

    Thanks for your help, Really appreciate

    • This reply was modified 3 months ago by siddheshsj.
    siddheshsj

    (@siddheshsj)

    Hi,

    Sorry to trouble you again!I see that you have used base_meta table for storing user info and i wanted to know if i can use any filter to add custom field which will get displayed along with other data of booking??

    Thanks

    Plugin Author Hakan Ozevin

    (@puckrobin)

    You can use wpb_add_app_meta, wpb_update_app_meta and wpb_get_app_meta function to save and retrieve booking metas. After the next update, $booking->add_meta(), $booking->update_meta(), and $booking->get_meta() methods will also be available.

    Displaying them is another story though. It depends on what those fields are and where you want to display them.

    siddheshsj

    (@siddheshsj)

    I need to add those custom fields before the new appointment is saved and use the custom field to send in an email.
    While displaying it should be displayed just below postcode of clients block in admin

    Plugin Author Hakan Ozevin

    (@puckrobin)

    You cannot add those fields before new appointment is saved, because booking ID is only available after appointment is saved.

    Use these hooks:
    To save custom fields: app_new_appointment
    To embed them in emails: app_email_replace_pre
    To display them in admin: app_inline_edit_user_fields

    We do have an addon (UDF – User Defined Fields) which already does all of these, though. Please have a look at our website as I am not allowed to give more information in these forums.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.