Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
CRAP
n/a
0 / 0
wpcomsh_hydrate_podcast_module
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
20
1<?php
2/**
3 * Turn the Jetpack Podcast module on for Atomic sites.
4 *
5 * Podcast ships as a Jetpack module that Jetpack hides on self-hosted sites
6 * until go-live. On Atomic we opt in early and force the module active so every
7 * site hydrates its stored `jetpack_active_modules` setting — mirroring today's
8 * always-on behavior. Removing this file at self-hosted go-live leaves the
9 * hydrated setting in place, so sites stay on but the module becomes
10 * user-toggleable.
11 *
12 * @package wpcomsh
13 */
14
15// Opt Atomic into the module: un-hides it, and new sites pick it up via its
16// `Auto Activate` header.
17add_filter( 'jetpack_podcast_for_the_world', '__return_true' );
18
19/**
20 * Force Podcast active so every Atomic site hydrates its stored module setting.
21 *
22 * @return void
23 */
24function wpcomsh_hydrate_podcast_module() {
25    if ( ! defined( 'JETPACK__VERSION' ) || ! class_exists( 'Jetpack' ) ) {
26        return;
27    }
28
29    if ( ! Jetpack::is_module_active( 'podcast' ) ) {
30        Jetpack::activate_module( 'podcast', false, false );
31    }
32}
33add_action( 'init', 'wpcomsh_hydrate_podcast_module', 0, 0 );