megacal_before_save_event
Allows you to run custom code just before an Event is saved
Params:
- Array $args The request arguments
- String $action The action being performed – ‘update_event’, ‘create_event’
Examples:
// .. functions.php .. function my_custom_function( $args, $action ) { if( 'update_event' == $action ) { // Do something } } add_action( 'megacal_before_save_event', 'my_custom_function', 10, 2 );
Source:
/** * Action Hook: megacal_before_save_event * Runs just before an Event is saved * * @param array $args The request arguments * @param string $action The action being performed - 'update_event', 'create_event' */ do_action( 'megacal_before_save_event', $params, $action );
megacal_after_save_event
Allows you to run custom code just after an Event is successfully saved
Params:
- Array $args The request arguments
- String $action The action being performed – ‘update_event’, ‘create_event’
- MegaCalResponse $response The API response – Should be type EventUpsertResponse
Examples:
// .. functions.php .. function my_custom_function( $args, $action, $response ) { if( 'update_event' == $action ) { // Do something } } add_action( 'megacal_after_save_event', 'my_custom_function', 10, 3 );
Source:
/** * Action Hook: megacal_after_save_event * Runs just after an Event is successfully saved * * @param array $args The request arguments * @param string $action The action being performed - 'update_event', 'create_event' * @param MegaCalResponse $response The API response - Should be type EventUpsertResponse */ do_action( 'megacal_after_save_event', $params, $action, $response );
megacal_after_save_event_error
Allows you to run custom code when an error occurs during saving an event
Params:
- Array $args The request arguments
- String $action The action being performed – ‘update_event’, ‘create_event’
- ApiException $e The exception thrown during saving
Examples:
// .. functions.php .. function my_custom_function( $args, $action, $error ) { error_log( $error->get_simple_message() ); } add_action( 'megacal_after_save_event_error', 'my_custom_function', 10, 3 );
Source:
/** * Action Hook: megacal_after_save_event * Runs after an Event is saved, if an error occurred * * @param array $args The request arguments * @param string $action The action being performed - 'update_event', 'create_event' * @param ApiException $e The exception thrown during saving */ do_action( 'megacal_after_save_event_error', $params, $action, $e );
megacal_before_delete_event
Allows you to run custom code just before an event is deleted
Params:
- Int $event_id The Event ID to be deleted
- String $change_type The Event change type
Examples:
// .. functions.php .. function my_custom_function( $event_id, $change_type ) { error_log( 'About to delete event ID: ' . $event_id ); } add_action( 'megacal_before_delete_event', 'my_custom_function', 10, 2 );
Source:
/** * Action Hook: megacal_before_delete_event * Runs just before an Event is deleted * * @param int $event_id The Event ID * @param string $change_type The Event change type */ do_action( 'megacal_before_delete_event', $event_id, $event_change_type );
megacal_after_delete_event
Allows you to run custom code just after an event is deleted
Params:
- Int $event_id The Event ID to be deleted
- String $change_type The Event change type
- MegaCalResponse $response The API response – Should be EventDeleteResponse
Examples:
// .. functions.php .. function my_custom_function( $event_id, $change_type, $response ) { error_log( 'Just deleted event ID: ' . $event_id ); } add_action( 'megacal_after_delete_event', 'my_custom_function', 10, 3 );
Source:
/** * Action Hook: megacal_after_delete_event * Runs just after an Event is deleted * * @param int $event_id The Event ID * @param string $change_type The Event change type * @param MegaCalResponse The API response - Should be EventDeleteResponse */ do_action( 'megacal_after_delete_event', $event_id, $event_change_type, $response );
megacal_after_delete_event_error
Allows you to run custom code when an error occurs during deleting an event
Params:
- Int $event_id The Event ID to be deleted
- String $change_type The Event change type
- ApiException $e The exception thrown
Examples:
// .. functions.php .. function my_custom_function( $event_id, $change_type, $error ) { error_log( 'Tried to delete event ID: ' . $event_id ); error_log( $error->get_simple_message() ); } add_action( 'megacal_after_delete_event_error', 'my_custom_function', 10, 3 );
Source:
/** * Action Hook: megacal_after_delete_event_error * Runs after an Event is deleted, if an error occurred * * @param int $event_id The Event ID * @param string $change_type The Event change type * @param ApiException $e The exception thrown */ do_action( 'megacal_after_delete_event_error', $event_id, $event_change_type, $e );
megacal_before_flush_event_cache_{cache_key}
Allows you to run custom code just before a specific event cache key is flushed
Params:
- String $cache_key The cache key
Examples:
// .. functions.php .. if( defined( 'MEGACAL_ADMIN_CALENDAR_CACHE_KEY' ) ) { function my_custom_function() { // Do something before the admin event cache is flushed } add_action( 'megacal_before_flush_event_cache_' . MEGACAL_ADMIN_CALENDAR_CACHE_KEY, $cache_key, 10, 0 ); }
Source:
/** * Action Hook: megacal_before_flush_event_cache_{cache_key} * Runs before the specified transient is deleted * * @param string $cache_key The cache key */ do_action( 'megacal_before_flush_event_cache_' . $cache_key, $cache_key );
megacal_after_flush_event_cache_{cache_key}
Allows you to run custom code just after a specific event cache key is flushed
Params:
- String $cache_key The cache key
Examples:
// .. functions.php .. if( defined( 'MEGACAL_ADMIN_CALENDAR_CACHE_KEY' ) ) { function my_custom_function() { // Do something after } add_action( 'megacal_after_flush_event_cache_' . MEGACAL_ADMIN_CALENDAR_CACHE_KEY, $cache_key, 10, 0 ); }
Source:
/** * Action Hook: megacal_after_flush_event_cache_{cache_key} * Runs after the specified transient is deleted * * @param string $cache_key The cache key */ do_action( 'megacal_after_flush_event_cache_' . $cache_key, $cache_key );
megacal_before_flush_upsert_cache_{cache_key}
Allows you to run custom code just before a specific upsert cache key is flushed
Params:
- String $cache_key The cache key
Examples:
// .. functions.php .. if( defined( 'MEGACAL_CACHED_VENUES_CACHE_KEY' ) ) { function my_custom_function() { // Do something before the Venue cache is flushed } add_action( 'megacal_before_flush_upsert_cache_' . MEGACAL_CACHED_VENUES_CACHE_KEY, $cache_key, 10, 0 ); }
Source:
/** * Action Hook: megacal_before_flush_upsert_cache_{cache_key} * Runs before the specified transient is deleted * * @param string $cache_key The cache key */ do_action( 'megacal_before_flush_upsert_cache_' . $cache_key, $cache_key );
megacal_after_flush_upsert_cache_{cache_key}
Allows you to run custom code just after a specific upsert cache key is flushed
Params:
- String $cache_key The cache key
Examples:
// .. functions.php .. if( defined( 'MEGACAL_CACHED_VENUES_CACHE_KEY' ) ) { function my_custom_function() { // Do something after the Venue cache is flushed } add_action( 'megacal_after_flush_upsert_cache_' . MEGACAL_CACHED_VENUES_CACHE_KEY, $cache_key, 10, 0 ); }
Source:
/** * Action Hook: megacal_after_flush_upsert_cache_{cache_key} * Runs after the specified transient is deleted * * @param string $cache_key The cache key */ do_action( 'megacal_after_flush_upsert_cache_' . $cache_key, $cache_key );