Updater::video_source_migration()
Migration to the video source dropdown.
Source
File: src/Tribe/Updater.php
public function video_source_migration() {
$args = [
'posts_per_page' => 500,
'meta_query' => [
[
'relation' => 'OR',
[
'key' => Event_Meta::$key_virtual,
'value' => true,
],
[
'key' => Event_Meta::$key_virtual,
'value' => 'yes',
]
],
[
'key' => Event_Meta::$key_video_source,
'compare' => 'NOT EXISTS',
]
],
];
$virtual_events = tribe_events()->by_args( $args )->get_ids();
foreach ( $virtual_events as $event_id ) {
$event = tribe_get_event( $event_id );
// Safety check.
if ( $event->virtual_video_source ) {
continue;
}
// If a virtual event has zoom as the meeting provider
if ( 'zoom' === $event->virtual_meeting_provider ) {
update_post_meta( $event_id, Event_Meta::$key_video_source, 'zoom' );
continue;
}
// Default to video as the video source.
update_post_meta( $event_id, Event_Meta::$key_video_source, 'video' );
}
}
Changelog
| Version | Description |
|---|---|
| 1.6.0 | Introduced. |