public function do_publish($id, $post)
{
if ('publish' != $post->post_status || !in_array($post->post_type, $this->settings->get('post_types')) || !current_user_can(apply_filters('apple_news_publish_capability', 'manage_options')) && !(defined('DOING_CRON') && DOING_CRON)) {
return;
}
// If the post has been marked as deleted from the API, ignore this update.
$deleted = get_post_meta($id, 'apple_news_api_deleted', true);
if ($deleted) {
return;
}
// Proceed based on the current settings for auto publish and update.
$updated = get_post_meta($id, 'apple_news_api_id', true);
if ($updated && 'yes' != $this->settings->get('api_autosync_update') || !$updated && 'yes' != $this->settings->get('api_autosync')) {
return;
}
// Proceed with the push
$action = new Apple_Actions\Index\Push($this->settings, $id);
try {
$action->perform();
} catch (Apple_Actions\Action_Exception $e) {
Admin_Apple_Notice::error($e->getMessage());
}
}