Additional Fields data not being sent to hook

I'm trying to send new appointment information to Act-On by adding the following code to my theme's functions.php, and it's all working, except that the extra field data from the Additional Fields plugin on Appointments+ isn't being passed through to my function (though it is showing in the plugin's appointment list).

Any ideas on how I can have that data pass through with the rest of the appointment submission?

add_action( 'wpmudev_appointments_insert_appointment', 'send_to_acton', 99, 1 );
function send_to_acton( $app_id ) {
	global $appointments;
	$data = $appointments->get_app( $app_id );
	// Send data to Act-On
}
  • Kasia Swiderska

    Hello Chris,

    The additional fields are not a core part of the plugin, hence the data that's passed in from the additional fields doesn't land in the appointments table. Rather, it's stored packed as a meta information in the options table.
    I will need to ping developer on how to restore those fields values - however I noticed that you are not using latest version of the plugin. Last version is 1.9.4 - is there a reason you are not updating plugin?
    As soon as I will get feedback from dev I'll get back to you.

    kind regards,
    Kasia

  • Kasia Swiderska

    Hello Chris,

    Please check this code I got from developer

    function send_to_acton( $app_id ) {
            if ( ! function_exists( 'appointments_get_app_additional_fields' ) ) {
                $additional_fields = appointments_get_appointment_meta( $app_id, 'additional_fields' );
                if ( empty( $additional_fields ) || ! is_array( $additional_fields ) ) {
                    return array();
                }
                return $additional_fields;
            }
            else {
                // This function will exist on next version (if the addon is active)
                return appointments_get_app_additional_fields( $app_id );
            }
        }

    Let me know if this will work for you.

    kind regards,
    Kasia

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.