From dd762440e6096ee8f2785bae61b5ae76e7369116 Mon Sep 17 00:00:00 2001
From: Dat Hoang
Date: Tue, 14 Jan 2020 23:40:51 +0700
Subject: [PATCH] Subscriptions: Add a clear message when an email having many
pending confirmations tries to subscribe a site. (#14275)
Give a clear error message when email addresses are having many pending subscriptions
---
modules/subscriptions.php | 3 +++
modules/subscriptions/views.php | 30 ++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/modules/subscriptions.php b/modules/subscriptions.php
index ee1f5ec564e04..6bb538cb3e89a 100644
--- a/modules/subscriptions.php
+++ b/modules/subscriptions.php
@@ -659,6 +659,9 @@ function widget_submit() {
case 'pending':
$result = 'already';
break;
+ case 'flooded_email':
+ $result = 'many_pending_subs';
+ break;
default:
$result = 'error';
break;
diff --git a/modules/subscriptions/views.php b/modules/subscriptions/views.php
index fc578db4f10f7..8b3ee03fc3f1a 100644
--- a/modules/subscriptions/views.php
+++ b/modules/subscriptions/views.php
@@ -6,6 +6,20 @@ class Jetpack_Subscriptions_Widget extends WP_Widget {
* @var array When printing the submit button, what tags are allowed
*/
static $allowed_html_tags_for_submit_button = array( 'br' => array() );
+ /**
+ * Use this variable when printing the message after submitting an email in subscription widgets
+ *
+ * @var array what tags are allowed
+ */
+ public static $allowed_html_tags_for_message = array(
+ 'a' => array(
+ 'href' => array(),
+ 'title' => array(),
+ 'rel' => array(),
+ 'target' => array(),
+ ),
+ 'br' => array(),
+ );
function __construct() {
$widget_ops = array(
@@ -150,6 +164,22 @@ static function render_widget_status_messages( $instance ) {
__( 'Manage your email preferences.', 'jetpack' )
); ?>
+
+ Approve or delete a few subscriptions at subscribe.wordpress.com before continuing.', 'jetpack' ),
+ self::$allowed_html_tags_for_message
+ ),
+ 'https://subscribe.wordpress.com/',
+ esc_attr__( 'Manage your email preferences.', 'jetpack' )
+ );
+ ?>
+
+