@@ -665,32 +665,34 @@ function render_block( $attributes ) {
665
665
$ include_social_followers = isset ( $ attributes ['includeSocialFollowers ' ] ) ? (bool ) get_attribute ( $ attributes , 'includeSocialFollowers ' ) : true ;
666
666
667
667
$ data = array (
668
- 'widget_id ' => Jetpack_Subscriptions_Widget::$ instance_count ,
669
- 'subscribe_email ' => $ subscribe_email ,
670
- 'is_paid_subscriber ' => get_attribute ( $ attributes , 'isPaidSubscriber ' , false ),
671
- 'wrapper_attributes ' => get_block_wrapper_attributes (
668
+ 'widget_id ' => Jetpack_Subscriptions_Widget::$ instance_count ,
669
+ 'subscribe_email ' => $ subscribe_email ,
670
+ 'is_paid_subscriber ' => get_attribute ( $ attributes , 'isPaidSubscriber ' , false ),
671
+ 'wrapper_attributes ' => get_block_wrapper_attributes (
672
672
array (
673
673
'class ' => $ classes ['block_wrapper ' ],
674
674
)
675
675
),
676
- 'subscribe_placeholder ' => get_attribute ( $ attributes , 'subscribePlaceholder ' , __ ( 'Type your email… ' , 'jetpack ' ) ),
677
- 'submit_button_text ' => get_attribute ( $ attributes , 'submitButtonText ' , __ ( 'Subscribe ' , 'jetpack ' ) ),
678
- 'submit_button_text_subscribed ' => get_attribute ( $ attributes , 'submitButtonTextSubscribed ' , __ ( 'Subscribed ' , 'jetpack ' ) ),
679
- 'submit_button_text_upgrade ' => get_attribute ( $ attributes , 'submitButtonTextUpgrade ' , __ ( 'Upgrade subscription ' , 'jetpack ' ) ),
680
- 'success_message ' => get_attribute (
676
+ 'subscribe_placeholder ' => get_attribute ( $ attributes , 'subscribePlaceholder ' , __ ( 'Type your email… ' , 'jetpack ' ) ),
677
+ 'submit_button_text ' => get_attribute ( $ attributes , 'submitButtonText ' , __ ( 'Subscribe ' , 'jetpack ' ) ),
678
+ 'submit_button_text_subscribed ' => get_attribute ( $ attributes , 'submitButtonTextSubscribed ' , __ ( 'Subscribed ' , 'jetpack ' ) ),
679
+ 'submit_button_text_upgrade ' => get_attribute ( $ attributes , 'submitButtonTextUpgrade ' , __ ( 'Upgrade subscription ' , 'jetpack ' ) ),
680
+ 'success_message ' => get_attribute (
681
681
$ attributes ,
682
682
'successMessage ' ,
683
683
esc_html__ ( "Success! An email was just sent to confirm your subscription. Please find the email now and click 'Confirm' to start subscribing. " , 'jetpack ' )
684
684
),
685
- 'show_subscribers_total ' => (bool ) get_attribute ( $ attributes , 'showSubscribersTotal ' ),
686
- 'subscribers_total ' => get_attribute ( $ attributes , 'showSubscribersTotal ' ) ? get_subscriber_count ( $ include_social_followers ) : 0 ,
687
- 'referer ' => esc_url_raw (
685
+ 'show_subscribers_total ' => (bool ) get_attribute ( $ attributes , 'showSubscribersTotal ' ),
686
+ 'subscribers_total ' => get_attribute ( $ attributes , 'showSubscribersTotal ' ) ? get_subscriber_count ( $ include_social_followers ) : 0 ,
687
+ 'referer ' => esc_url_raw (
688
688
( is_ssl () ? 'https ' : 'http ' ) . ':// ' . ( isset ( $ _SERVER ['HTTP_HOST ' ] ) ? wp_unslash ( $ _SERVER ['HTTP_HOST ' ] ) : '' ) .
689
689
( isset ( $ _SERVER ['REQUEST_URI ' ] ) ? wp_unslash ( $ _SERVER ['REQUEST_URI ' ] ) : '' )
690
690
),
691
- 'source ' => 'subscribe-block ' ,
692
- 'app_source ' => get_attribute ( $ attributes , 'appSource ' , null ),
693
- 'class_name ' => get_attribute ( $ attributes , 'className ' ),
691
+ 'source ' => 'subscribe-block ' ,
692
+ 'app_source ' => get_attribute ( $ attributes , 'appSource ' , null ),
693
+ 'class_name ' => get_attribute ( $ attributes , 'className ' ),
694
+ 'selected_newsletter_categories ' => get_attribute ( $ attributes , 'selectedNewsletterCategoryIds ' , array () ),
695
+ 'preselected_newsletter_categories ' => get_attribute ( $ attributes , 'preselectNewsletterCategories ' , false ),
694
696
);
695
697
696
698
if ( ! jetpack_is_frontend () ) {
@@ -850,6 +852,10 @@ class="screen-reader-text"
850
852
if ( ! empty ( $ tier_id ) ) {
851
853
echo '<input type="hidden" name="tier_id" value=" ' . esc_attr ( $ tier_id ) . '"/> ' ;
852
854
}
855
+
856
+ if ( $ data ['preselected_newsletter_categories ' ] && ! empty ( $ data ['selected_newsletter_categories ' ] ) ) {
857
+ echo '<input type="hidden" name="selected_newsletter_categories" value=" ' . esc_attr ( implode ( ', ' , $ data ['selected_newsletter_categories ' ] ) ) . '"/> ' ;
858
+ }
853
859
?>
854
860
<button type="submit"
855
861
<?php if ( ! empty ( $ classes ['submit_button ' ] ) ) : ?>
0 commit comments