Tribe__Events__Tickets__Eventbrite__Aggregator::save_callback( array $items, array $meta, Tribe__Events__Aggregator__Record__Activity $activity )
Update the EA record, once the import has been completed, only when the import was done from “your account” and only for Eventbrite. A call is made back to EA to register a callback associated with this import.
Contents
Parameters
- $items
-
(array) (Required) An array of items to insert.
- $meta
-
(array) (Required) The record meta information.
- $activity
-
(Tribe__Events__Aggregator__Record__Activity) (Required) The record insertion activity repo.
Source
File: src/Tribe/Aggregator.php
public function save_callback( $items, $meta, $activity ) {
if (
empty( $meta['preview'] )
|| empty( $meta['import_id'] )
|| empty( $meta['finalized'] )
|| empty( $meta['origin'] )
|| empty( $meta['source'] )
|| empty( $meta['hash'] )
|| 'eventbrite' !== $meta['origin']
|| 'https://www.eventbrite.com/me' !== $meta['source']
) {
do_action( 'tribe_log', 'debug', __METHOD__, [ 'The import does not meet all the required criteria' ] );
return;
}
$result = tribe( 'events-aggregator.main' )
->api( 'import' )
->update(
$meta['import_id'],
[
'callback' => home_url( '/event-aggregator/insert/?key=' . urlencode( $meta['hash'] ) ),
'origin' => $meta['origin'],
]
);
do_action(
'tribe_log',
is_wp_error( $result ) ? 'warning' : 'debug',
__METHOD__,
[
'import_id' => $meta['import_id'],
'hash' => $meta['hash'],
'origin' => $meta['origin'],
]
);
}
Changelog
| Version | Description |
|---|---|
| 4.6.5 | Introduced. |