Plugin actions / cbc unpublish video

Description

This action is conditioned by option “Check video status after import” from plugin Settings. If the option is on and after checking the video status YouTube API returns anything other than a public video response (ie. video was deleted or embed privacy settings were change to disallow embeds), the plugin will set post status to pending and trigger this action.

Parameters

$post
(WP_Object)(optional) The current WP_Post object

Default:None
$video
(array)(optional) The video details array returned by YouTube API

Default:None

Examples

Send an e-mail to blog admin each time a video gets unpublished because YouTube API returns the video as non-public or deleted.

/**
 * E-mail administrator every time a video gets unpublished
 * @param WP_Post $post
 * @param array $video
 */
function video_unpublish_manager( $post, $video ){
	wp_mail( 
		get_bloginfo( 'admin_email' ), 
		__('Unpublished video'), 
		sprintf( __('Post ID %d was unpublished.'), $post->ID ) 
	);
}
add_action( 'cbc_unpublish_video', 'video_unpublish_manager', 10, 2 );

Related