Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: other

Add default_option_subscription_options filter
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,11 @@ public function get_settings_response() {
'launchpad_screen' => (string) get_option( 'launchpad_screen' ),
'wpcom_featured_image_in_email' => (bool) get_option( 'wpcom_featured_image_in_email' ),
'wpcom_gifting_subscription' => (bool) get_option( 'wpcom_gifting_subscription', $this->get_wpcom_gifting_subscription_default() ),
'subscription_options' => (array) get_option( 'subscription_options', array() ),
'wpcom_subscription_emails_use_excerpt' => $this->get_wpcom_subscription_emails_use_excerpt_option(),
'show_on_front' => (string) get_option( 'show_on_front' ),
'page_on_front' => (string) get_option( 'page_on_front' ),
'page_for_posts' => (string) get_option( 'page_for_posts' ),
'subscription_options' => (array) get_option( 'subscription_options' ),
);

if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
Expand Down
2 changes: 1 addition & 1 deletion projects/plugins/jetpack/modules/subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ public function get_default_settings() {
* Reeturn merged `subscription_options` option with module default settings.
*/
public function get_settings() {
return wp_parse_args( (array) get_option( 'subscription_options', array() ), $this->get_default_settings() );
return wp_parse_args( (array) get_option( 'subscription_options' ), $this->get_default_settings() );
}

/**
Expand Down
29 changes: 29 additions & 0 deletions projects/plugins/jetpack/modules/subscriptions/views.php
Original file line number Diff line number Diff line change
Expand Up @@ -998,3 +998,32 @@ function jetpack_blog_subscriptions_init() {
}

add_action( 'widgets_init', 'jetpack_blog_subscriptions_init' );

/**
* Sets the default value for `subscription_options` site option.
*
* This default value is available across Simple, Atomic and Jetpack sites,
* including the /sites/$site/settings endpoint.
*
* @param array $default Default `subscription_options` array.
* @param string $option Option name.
* @param bool $passed_default Whether `get_option()` passed a default value.
*
* @return array Default value of `subscription_options`.
*/
function subscription_options_fallback( $default, $option, $passed_default ) {
if ( $passed_default ) {
return $default;
}

$site_url = get_home_url();
$display_url = preg_replace( '(^https?://)', '', untrailingslashit( $site_url ) );

return array(
/* translators: Both %1$s and %2$s is site address */
'invitation' => sprintf( __( "Howdy,\nYou recently subscribed to <a href='%1\$s'>%2\$s</a> and we need to verify the email you provided. Once you confirm below, you'll be able to receive and read new posts.\n\nIf you believe this is an error, ignore this message and nothing more will happen.", 'jetpack' ), $site_url, $display_url ),
'comment_follow' => __( "Howdy.\n\nYou recently followed one of my posts. This means you will receive an email when new comments are posted.\n\nTo activate, click confirm below. If you believe this is an error, ignore this message and we'll never bother you again.", 'jetpack' ),
);
}

add_filter( 'default_option_subscription_options', 'subscription_options_fallback', 10, 3 );