Action uncanny-automator-pro

automator_ameliabooking_time_updated

Fires after an Amelia booking time has been successfully updated, providing access to reservation, booking, and container data.

add_action( 'automator_ameliabooking_time_updated', $callback, 10, 3 );

Description

Fires when the time of an Amelia Booking appointment is updated. Developers can use this hook to perform custom actions when an appointment's time changes, such as sending notifications or updating external systems. The hook passes the reservation, individual booking, and a container object for further context.


Usage

add_action( 'automator_ameliabooking_time_updated', 'your_function_name', 10, 3 );

Parameters

$reservation (mixed)
This parameter contains the reservation object for the AmeliBooking.
$booking (mixed)
This parameter contains information about the reservation that was updated.
$container (mixed)
This parameter contains an array of booking objects associated with the reservation.

Examples

<?php
/**
 * Example of how to hook into the automator_ameliabooking_time_updated action.
 *
 * This function will be executed whenever a booking's time is updated in Amelia.
 * It can be used to trigger custom logic, send notifications, or update other systems.
 *
 * @param object $reservation The Amelia reservation object.
 * @param object $booking     The specific Amelia booking object.
 * @param object $container   The Uncanny Automator container object.
 */
function my_custom_ameliabooking_time_update_logic( $reservation, $booking, $container ) {

	// Check if we have valid data before proceeding.
	if ( ! $reservation || ! $booking || ! $container ) {
		return;
	}

	// Example: Log the booking ID and the new time.
	$booking_id = $booking->get_id();
	$new_time   = $booking->get_time(); // Assuming a method to get the updated time.

	// You might want to check if this is a real-time update or a re-schedule.
	// This often depends on how Amelia itself handles the update.
	// For demonstration, we'll just log.
	error_log( "Amelia booking ID {$booking_id} has been updated to time: {$new_time}." );

	// Example: If you needed to fetch more details about the reservation or booking,
	// you could use methods provided by the Amelia objects.
	// For example, to get the customer's name:
	// $customer_name = $reservation->get_customer_name();
	// error_log( "Customer: {$customer_name}" );

	// If this hook were part of a Uncanny Automator plugin development,
	// you might interact with the $container object to access Automator's internal functions
	// or to prepare data for a new Automator trigger.
	// For instance, to trigger a new Automator workflow:
	// $container->trigger_event( 'MY_CUSTOM_AMELIA_TIME_UPDATE_TRIGGER', $booking_id, array( 'new_time' => $new_time ) );
}

// Add the action hook with a priority of 10 and expecting 3 arguments.
add_action( 'automator_ameliabooking_time_updated', 'my_custom_ameliabooking_time_update_logic', 10, 3 );

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

uncanny-automator-pro/src/integrations/ameliabooking/helpers/ameliabooking-pro-helpers.php:87

public function ameliabooking_time_updated( $reservation, $bookings, $container ) {

		// Delegate the action to the automator_ameliabooking_time_updated action hook.
		foreach ( $bookings as $booking ) {
			// Fires the trigger for each booking.
			do_action( 'automator_ameliabooking_time_updated', $reservation, $booking, $container );
		}
	}


Internal Usage

Found in uncanny-automator-pro/src/integrations/ameliabooking/triggers/amelia-appointment-booked-service-rescheduled.php:62:

$this->add_action( 'automator_ameliabooking_time_updated' );

Found in uncanny-automator-pro/src/integrations/ameliabooking/triggers/amelia-user-appointment-booked-service-rescheduled.php:61:

$this->add_action( 'automator_ameliabooking_time_updated' );
Scroll to Top