| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName) |
| 2 | 2 | /** |
| 3 | 3 | * Module Name: Newsletter |
| 4 | - * Module Description: Let visitors subscribe to new posts and comments via email | |
| 4 | + * Module Description: Grow your subscriber list and deliver your content directly to their email inbox. | |
| 5 | 5 | * Sort Order: 9 |
| 6 | 6 | * Recommendation Order: 8 |
| 7 | 7 | * First Introduced: 1.2 |
| 8 | 8 | * Requires Connection: Yes |
| @@ -20,8 +20,9 @@ | ||
| 20 | 20 | use Automattic\Jetpack\Connection\XMLRPC_Async_Call; |
| 21 | 21 | use Automattic\Jetpack\Redirect; |
| 22 | 22 | use Automattic\Jetpack\Status; |
| 23 | 23 | use Automattic\Jetpack\Status\Host; |
| 24 | +use Automattic\Jetpack\Subscribers_Dashboard\Dashboard as Subscribers_Dashboard; | |
| 24 | 25 | |
| 25 | 26 | add_action( 'jetpack_modules_loaded', 'jetpack_subscriptions_load' ); |
| 26 | 27 | |
| 27 | 28 | // Loads the User Content Link Redirection feature. |
| @@ -128,8 +129,9 @@ | ||
| 128 | 129 | add_filter( 'post_updated_messages', array( $this, 'update_published_message' ), 18, 1 ); |
| 129 | 130 | |
| 130 | 131 | // Set "social_notifications_subscribe" option during the first-time activation. |
| 131 | 132 | add_action( 'jetpack_activate_module_subscriptions', array( $this, 'set_social_notifications_subscribe' ) ); |
| 133 | + add_action( 'jetpack_activate_module_subscriptions', array( $this, 'set_featured_image_in_email_default' ) ); | |
| 132 | 134 | |
| 133 | 135 | // Hide subscription messaging in Publish panel for posts that were published in the past |
| 134 | 136 | add_action( 'init', array( $this, 'register_post_meta' ), 20 ); |
| 135 | 137 | add_action( 'transition_post_status', array( $this, 'maybe_set_first_published_status' ), 10, 3 ); |
| @@ -146,8 +148,10 @@ | ||
| 146 | 148 | ); |
| 147 | 149 | |
| 148 | 150 | // Track categories created through the category editor page |
| 149 | 151 | add_action( 'wp_ajax_add-tag', array( $this, 'track_newsletter_category_creation' ), 1 ); |
| 152 | + $subscribers_dashboard = new Subscribers_Dashboard(); | |
| 153 | + $subscribers_dashboard::init(); | |
| 150 | 154 | } |
| 151 | 155 | |
| 152 | 156 | /** |
| 153 | 157 | * Jetpack_Subscriptions::xmlrpc_methods() |
| @@ -856,9 +860,9 @@ | ||
| 856 | 860 | public function set_cookies( $subscribe_to_post = false, $post_id = null, $subscribe_to_blog = false ) { |
| 857 | 861 | $post_id = (int) $post_id; |
| 858 | 862 | |
| 859 | 863 | /** This filter is already documented in core/wp-includes/comment-functions.php */ |
| 860 | - $cookie_lifetime = apply_filters( 'comment_cookie_lifetime', 30000000 ); | |
| 864 | + $cookie_lifetime = apply_filters( 'comment_cookie_lifetime', YEAR_IN_SECONDS ); | |
| 861 | 865 | |
| 862 | 866 | /** |
| 863 | 867 | * Filter the Jetpack Comment cookie path. |
| 864 | 868 | * |
| @@ -907,8 +911,17 @@ | ||
| 907 | 911 | } |
| 908 | 912 | } |
| 909 | 913 | |
| 910 | 914 | /** |
| 915 | + * Set the featured image in email option to `1` when the Subscriptions module is activated in the first time. | |
| 916 | + * | |
| 917 | + * @return void | |
| 918 | + */ | |
| 919 | + public function set_featured_image_in_email_default() { | |
| 920 | + add_option( 'wpcom_featured_image_in_email', 1 ); | |
| 921 | + } | |
| 922 | + | |
| 923 | + /** | |
| 911 | 924 | * Save a flag when a post was ever published. |
| 912 | 925 | * |
| 913 | 926 | * It saves the post meta when the post was published and becomes a draft. |
| 914 | 927 | * Then this meta is used to hide subscription messaging in Publish panel. |
| @@ -972,8 +985,19 @@ | ||
| 972 | 985 | * |
| 973 | 986 | * @return void |
| 974 | 987 | */ |
| 975 | 988 | public function add_subscribers_menu() { |
| 989 | + /** | |
| 990 | + * Enables the new in development subscribers in wp-admin dashboard. | |
| 991 | + * | |
| 992 | + * @since 9.5.0 | |
| 993 | + * | |
| 994 | + * @param bool If the new dashboard is enabled. Default false. | |
| 995 | + */ | |
| 996 | + if ( apply_filters( 'jetpack_wp_admin_subscriber_management_enabled', false ) ) { | |
| 997 | + return; | |
| 998 | + } | |
| 999 | + | |
| 976 | 1000 | /* |
| 977 | 1001 | * Do not display any menu on WoA and WordPress.com Simple sites (unless Classic wp-admin is enabled). |
| 978 | 1002 | * They already get a menu item under Users via nav-unification. |
| 979 | 1003 | */ |
| @@ -1047,4 +1071,5 @@ | ||
| 1047 | 1071 | require __DIR__ . '/subscriptions/views.php'; |
| 1048 | 1072 | require __DIR__ . '/subscriptions/subscribe-modal/class-jetpack-subscribe-modal.php'; |
| 1049 | 1073 | require __DIR__ . '/subscriptions/subscribe-overlay/class-jetpack-subscribe-overlay.php'; |
| 1050 | 1074 | require __DIR__ . '/subscriptions/subscribe-floating-button/class-jetpack-subscribe-floating-button.php'; |
| 1075 | +require __DIR__ . '/subscriptions/newsletter-widget/class-jetpack-newsletter-dashboard-widget.php'; | |