Skip to content

Commit

Permalink
Update the defaults for stb_enabled and stc_enabled according to subs…
Browse files Browse the repository at this point in the history
…criptions being auto-activated so to not update the frontend unintentionally
  • Loading branch information
oskosk committed Feb 17, 2023
1 parent f61e213 commit a91df30
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
6 changes: 3 additions & 3 deletions projects/plugins/jetpack/modules/comments/comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,12 @@ public function comment_form_after() {
) . '</p>';
return;
}

if ( in_array( 'subscriptions', Jetpack::get_active_modules(), true ) ) {
$stb_enabled = get_option( 'stb_enabled', 1 );
$default = jetpack_get_module_info( 'subscriptions' )['auto_activate'] === 'No' ? 1 : 0;
$stb_enabled = get_option( 'stb_enabled', $default );
$stb_enabled = empty( $stb_enabled ) ? 0 : 1;

$stc_enabled = get_option( 'stc_enabled', 1 );
$stc_enabled = get_option( 'stc_enabled', $default );
$stc_enabled = empty( $stc_enabled ) ? 0 : 1;
} else {
$stb_enabled = 0;
Expand Down
14 changes: 10 additions & 4 deletions projects/plugins/jetpack/modules/subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,11 @@ public function subscriptions_settings_section() {
* Post Subscriptions Toggle.
*/
public function subscription_post_subscribe_setting() {

$stb_enabled = get_option( 'stb_enabled', 1 );
// Keep the previous behaviour after updating subscription to autoactivate
// So we don't update the frontend for new users of Jetpack
// https://github.com/Automattic/jetpack/pull/29028
$default = jetpack_get_module_info( 'subscriptions' )['auto_activate'] === 'No' ? 1 : 0;
$stb_enabled = get_option( 'stb_enabled', $default );
?>

<p class="description">
Expand All @@ -441,8 +444,11 @@ public function subscription_post_subscribe_setting() {
* Comments Subscriptions Toggle.
*/
public function subscription_comment_subscribe_setting() {

$stc_enabled = get_option( 'stc_enabled', 1 );
// Keep the previous behaviour after updating subscription to autoactivate
// So we don't update the frontend for new users of Jetpack
// https://github.com/Automattic/jetpack/pull/29028
$default = jetpack_get_module_info( 'subscriptions' )['auto_activate'] === 'No' ? 1 : 0;
$stc_enabled = get_option( 'stc_enabled', $default );
?>

<p class="description">
Expand Down

0 comments on commit a91df30

Please sign in to comment.