From 3f774fdb78dff03938aaed41d47e6241b5bdd79b Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Sat, 26 Oct 2019 22:18:28 -0700 Subject: [PATCH] Pledge Form: Add ability to resend pledge confirmation email. Fixes #49. --- plugins/wporg-5ftf/includes/pledge-form.php | 5 +++++ plugins/wporg-5ftf/includes/pledge-meta.php | 7 ++++++ plugins/wporg-5ftf/includes/pledge.php | 2 +- .../views/form-pledge-confirm-email.php | 18 ++++++++++----- .../views/inputs-pledge-org-email.php | 22 ++++++++++++++----- 5 files changed, 41 insertions(+), 13 deletions(-) diff --git a/plugins/wporg-5ftf/includes/pledge-form.php b/plugins/wporg-5ftf/includes/pledge-form.php index 4de5c99..c41f8cb 100755 --- a/plugins/wporg-5ftf/includes/pledge-form.php +++ b/plugins/wporg-5ftf/includes/pledge-form.php @@ -41,6 +41,11 @@ function render_form_new() { $pledge_id = filter_input( INPUT_GET, 'pledge_id', FILTER_VALIDATE_INT ); $unverified_token = filter_input( INPUT_GET, 'auth_token', FILTER_SANITIZE_STRING ); $email_confirmed = process_pledge_confirmation_email( $pledge_id, $action, $unverified_token ); + } else if ( filter_input( INPUT_GET, 'resend_pledge_confirmation' ) ) { + $pledge_id = filter_input( INPUT_GET, 'pledge_id', FILTER_VALIDATE_INT ); + $complete = true; + + Pledge\send_pledge_confirmation_email( $pledge_id, get_post()->ID ); } ob_start(); diff --git a/plugins/wporg-5ftf/includes/pledge-meta.php b/plugins/wporg-5ftf/includes/pledge-meta.php index e344c30..a9c38cf 100755 --- a/plugins/wporg-5ftf/includes/pledge-meta.php +++ b/plugins/wporg-5ftf/includes/pledge-meta.php @@ -221,6 +221,13 @@ function save_pledge( $pledge_id, $pledge ) { save_pledge_meta( $pledge_id, $submitted_meta ); + if ( filter_input( INPUT_POST, 'resend-pledge-confirmation' ) ) { + Pledge\send_pledge_confirmation_email( + filter_input( INPUT_GET, 'resend-pledge-id', FILTER_VALIDATE_INT ), + get_page_by_path( 'for-organizations' )->ID + ); + } + if ( filter_input( INPUT_POST, 'resend-contributor-confirmation' ) ) { PledgeForm\send_contributor_confirmation_emails( $pledge_id, diff --git a/plugins/wporg-5ftf/includes/pledge.php b/plugins/wporg-5ftf/includes/pledge.php index de58ac6..913acd5 100755 --- a/plugins/wporg-5ftf/includes/pledge.php +++ b/plugins/wporg-5ftf/includes/pledge.php @@ -156,7 +156,7 @@ function send_pledge_confirmation_email( $pledge_id, $action_page_id ) { $message = 'Thanks for committing to help keep WordPress sustainable! Please confirm this email address ' . - 'so that we can accept your pledge:' . "\n\n" . + 'in order to publish your pledge:' . "\n\n" . Email\get_authentication_url( $pledge_id, 'confirm_pledge_email', $action_page_id ) ; diff --git a/plugins/wporg-5ftf/views/form-pledge-confirm-email.php b/plugins/wporg-5ftf/views/form-pledge-confirm-email.php index 345f8c8..2c19433 100755 --- a/plugins/wporg-5ftf/views/form-pledge-confirm-email.php +++ b/plugins/wporg-5ftf/views/form-pledge-confirm-email.php @@ -5,6 +5,7 @@ namespace WordPressDotOrg\FiveForTheFuture\View; /** * @var bool $email_confirmed * @var string $directory_url + * @var int $pledge_id */ ?> @@ -31,12 +32,17 @@ namespace WordPressDotOrg\FiveForTheFuture\View; Your confirmation link has expired, please obtain a new one:

-

- -

+
+ + +

+ +

+
diff --git a/plugins/wporg-5ftf/views/inputs-pledge-org-email.php b/plugins/wporg-5ftf/views/inputs-pledge-org-email.php index 25c6688..4fef9b7 100644 --- a/plugins/wporg-5ftf/views/inputs-pledge-org-email.php +++ b/plugins/wporg-5ftf/views/inputs-pledge-org-email.php @@ -1,8 +1,14 @@
@@ -29,9 +35,13 @@ namespace WordPressDotOrg\FiveForTheFuture\View; - + add_query_arg( 'resend-pledge-id', $pledge->ID ) ) + ); ?>