Skip to content

Commit ac8361a

Browse files
authored
Subscriptions: Add Subscribe block post end placement setting to Sync (#36381)
1 parent 27658e1 commit ac8361a

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: minor
2+
Type: other
3+
4+
Subscriptions: Add Subscribe block post end placement setting to Sync

projects/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php

+9
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,15 @@ function ( $allowed_meta ) {
173173

174174
add_action( 'save_post_post', __NAMESPACE__ . '\add_paywalled_content_post_meta', 99, 1 );
175175

176+
add_filter(
177+
'jetpack_options_whitelist',
178+
function ( $options ) {
179+
$options[] = 'jetpack_subscriptions_subscribe_post_end_enabled';
180+
181+
return $options;
182+
}
183+
);
184+
176185
Jetpack_Subscription_Site::init()->handle_subscribe_block_placements();
177186
}
178187
add_action( 'init', __NAMESPACE__ . '\register_block', 9 );

projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-endpoint.php

+7
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
'rss_use_excerpt' => '(bool) Whether the RSS feed will use post excerpts',
120120
'launchpad_screen' => '(string) Whether or not launchpad is presented and what size it will be',
121121
'sm_enabled' => '(bool) Whether the newsletter subscribe modal is enabled',
122+
'jetpack_subscriptions_subscribe_post_end_enabled' => '(bool) Whether the subscribe block at the end of each post is enabled',
122123
'wpcom_ai_site_prompt' => '(string) User input in the AI site prompt',
123124
),
124125

@@ -452,6 +453,7 @@ function ( $newsletter_category ) {
452453
'wpcom_newsletter_categories' => $newsletter_category_ids,
453454
'wpcom_newsletter_categories_enabled' => (bool) get_option( 'wpcom_newsletter_categories_enabled' ),
454455
'sm_enabled' => (bool) get_option( 'sm_enabled' ),
456+
'jetpack_subscriptions_subscribe_post_end_enabled' => (bool) get_option( 'jetpack_subscriptions_subscribe_post_end_enabled' ),
455457
'wpcom_gifting_subscription' => (bool) get_option( 'wpcom_gifting_subscription', $this->get_wpcom_gifting_subscription_default() ),
456458
'wpcom_reader_views_enabled' => (bool) get_option( 'wpcom_reader_views_enabled', true ),
457459
'wpcom_subscription_emails_use_excerpt' => $this->get_wpcom_subscription_emails_use_excerpt_option(),
@@ -1084,6 +1086,11 @@ function ( $category_id ) {
10841086
$updated[ $key ] = (int) (bool) $value;
10851087
break;
10861088

1089+
case 'jetpack_subscriptions_subscribe_post_end_enabled':
1090+
update_option( 'jetpack_subscriptions_subscribe_post_end_enabled', (int) (bool) $value );
1091+
$updated[ $key ] = (int) (bool) $value;
1092+
break;
1093+
10871094
case 'show_on_front':
10881095
if ( in_array( $value, array( 'page', 'posts' ), true ) && update_option( $key, $value ) ) {
10891096
$updated[ $key ] = $value;

projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-options.php

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public function test_sync_default_options() {
8282
'stb_enabled' => true,
8383
'stc_enabled' => false,
8484
'sm_enabled' => false,
85+
'jetpack_subscriptions_subscribe_post_end_enabled' => false,
8586
'comment_registration' => 'pineapple',
8687
'show_avatars' => 'pineapple',
8788
'avatar_default' => 'pineapple',

0 commit comments

Comments
 (0)