From c10699f97c621487843552b2b9ef92df9e9d1966 Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Sat, 26 Oct 2019 10:59:06 -0700 Subject: [PATCH] Contributors: Add ability to resend confirmation email. Fixes: #50. --- plugins/wporg-5ftf/includes/contributor.php | 4 +++- plugins/wporg-5ftf/includes/pledge-meta.php | 7 +++++++ plugins/wporg-5ftf/views/manage-contributors.php | 16 ++++++++++------ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/plugins/wporg-5ftf/includes/contributor.php b/plugins/wporg-5ftf/includes/contributor.php index 4d01a49..11bdeed 100644 --- a/plugins/wporg-5ftf/includes/contributor.php +++ b/plugins/wporg-5ftf/includes/contributor.php @@ -158,12 +158,14 @@ function remove_contributor( $contributor_post_id ) { * * @param int $pledge_id The post ID of the pledge. * @param string $status Optional. 'all', 'pending', or 'publish'. + * @param int $contributor_id Optional. Retrieve a specific contributor instead of all. * * @return array An array of contributor posts. If $status is set to 'all', will be * a multidimensional array with keys for each status. */ -function get_pledge_contributors( $pledge_id, $status = 'publish' ) { +function get_pledge_contributors( $pledge_id, $status = 'publish', $contributor_id = null ) { $args = array( + 'page_id' => $contributor_id, 'post_type' => CPT_ID, 'post_parent' => $pledge_id, 'numberposts' => -1, diff --git a/plugins/wporg-5ftf/includes/pledge-meta.php b/plugins/wporg-5ftf/includes/pledge-meta.php index 85a105d..e344c30 100755 --- a/plugins/wporg-5ftf/includes/pledge-meta.php +++ b/plugins/wporg-5ftf/includes/pledge-meta.php @@ -220,6 +220,13 @@ function save_pledge( $pledge_id, $pledge ) { } save_pledge_meta( $pledge_id, $submitted_meta ); + + if ( filter_input( INPUT_POST, 'resend-contributor-confirmation' ) ) { + PledgeForm\send_contributor_confirmation_emails( + $pledge_id, + filter_input( INPUT_GET, 'resend-contributor-id', FILTER_VALIDATE_INT ) + ); + } } /** diff --git a/plugins/wporg-5ftf/views/manage-contributors.php b/plugins/wporg-5ftf/views/manage-contributors.php index 42c3d53..54ca076 100644 --- a/plugins/wporg-5ftf/views/manage-contributors.php +++ b/plugins/wporg-5ftf/views/manage-contributors.php @@ -31,15 +31,19 @@ namespace WordPressDotOrg\FiveForTheFuture\View; user_email, 32 ); ?> post_title ); ?> + post_status ) : ?> + add_query_arg( 'resend-contributor-id', $contributor_post->ID ) ) + ); ?> +