Skip to content

Commit

Permalink
Welcome message: Add support for the welcome email setting in wp-admin (
Browse files Browse the repository at this point in the history
#33677)

* Add support for the welcome email setting in wp-admin

* Remove the locale check

* Add welcome field to the defaults
  • Loading branch information
TimBroddin authored Oct 19, 2023
1 parent 1cb393a commit 15533a6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/add-welcome-email-field
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: enhancement

Add support for welcome message inside wp-admin
19 changes: 19 additions & 0 deletions projects/plugins/jetpack/modules/subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,14 @@ public function configure() {
'reading',
'email_settings'
);

add_settings_field(
'welcome',
__( 'Welcome email text', 'jetpack' ),
array( $this, 'setting_welcome' ),
'reading',
'email_settings'
);
}

/**
Expand Down Expand Up @@ -620,6 +628,15 @@ public function setting_comment_follow() {
echo '<p><span class="description">' . esc_html__( 'Introduction text sent when someone follows a post on your blog. (Site and confirmation details will be automatically added for you.)', 'jetpack' ) . '</span></p>';
}

/**
* HTML output helper for Welcome section.
*/
public function setting_welcome() {
$settings = $this->get_settings();
echo '<textarea name="subscription_options[welcome]" class="large-text" cols="50" rows="5">' . esc_textarea( $settings['welcome'] ) . '</textarea>';
echo '<p><span class="description">' . esc_html__( 'Welcome text sent when someone follows your blog.', 'jetpack' ) . '</span></p>';
}

/**
* Get default settings for the Subscriptions module.
*/
Expand All @@ -631,6 +648,8 @@ public function get_default_settings() {
/* 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' ),
/* translators: %1$s is the site address */
'welcome' => sprintf( __( 'Cool, you are now subscribed to %1$s and will receive an email notification when a new post is published.', 'jetpack' ), $display_url ),
);
}

Expand Down
2 changes: 2 additions & 0 deletions projects/plugins/jetpack/modules/subscriptions/views.php
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,8 @@ function subscription_options_fallback( $default, $option, $passed_default ) {
/* 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' ),
/* translators: %1$s is the site address */
'welcome' => sprintf( __( 'Cool, you are now subscribed to %1$s and will receive an email notification when a new post is published.', 'jetpack' ), $display_url ),
);
}

Expand Down

0 comments on commit 15533a6

Please sign in to comment.