Skip to content

Commit

Permalink
Sharing: handle WordPress.com's situation (stats always active)
Browse files Browse the repository at this point in the history
We cannot rely on `Jetpack::is_module_active()` on WordPress.com,
so we must do an additional check before to use the function.

@see #10120 (comment)
  • Loading branch information
jeherve committed Sep 18, 2018
1 parent dbe814e commit 40d7884
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion modules/sharedaddy/sharing-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -611,12 +611,19 @@ function sharing_add_footer() {
endif;
endif;

// Is the Stats module active? It is always active on WordPress.com.
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
$is_stats_active = true;
} else {
$is_stats_active = Jetpack::is_module_active( 'stats' );
}

wp_enqueue_script( 'sharing-js' );
$sharing_js_options = array(
'lang' => get_base_recaptcha_lang_code(),
/** This filter is documented in modules/sharedaddy/sharing-service.php */
'counts' => apply_filters( 'jetpack_sharing_counts', true ),
'is_stats_active' => Jetpack::is_module_active( 'stats' ),
'is_stats_active' => $is_stats_active,
);
wp_localize_script( 'sharing-js', 'sharing_js_options', $sharing_js_options );
}
Expand Down

0 comments on commit 40d7884

Please sign in to comment.