Manage Pledge: Allow pledge admins to change email (#113)

* Add the admin email field to the manage form
* Fix admin email processing: When the email is changed, the pledge needs to be set back to pending, until the email is re-confirmed
* Send confirmation emails for existing pledges to the "Manage Pledge" page
* Process the email confirmation & resending emails actions on both shortcodes
* Add a message for unconfirmed pledges
This commit is contained in:
Kelly Dwan 2019-11-26 15:37:19 -05:00 committed by GitHub
parent 544fe39199
commit 80b88399ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 139 additions and 65 deletions

View file

@ -4,8 +4,9 @@ namespace WordPressDotOrg\FiveForTheFuture\View;
use WP_Post;
/**
* @var bool $email_confirmed
* @var string $directory_url
* @var bool $email_confirmed
* @var bool $is_new_pledge
* @var int $pledge_id
* @var WP_Post|null $pledge
*/
@ -16,10 +17,17 @@ use WP_Post;
<div class="notice notice-success notice-alt">
<p>
<?php
printf(
wp_kses_post( __( 'Thank you for confirming your address! Weve emailed confirmation links to the contributors you mentioned, and your pledge will show up in <a href=\"%s\">the directory</a> once one contributor confirms their participation.', 'wporg-5ftf' ) ),
esc_url( $directory_url )
);
if ( $is_new_pledge ) {
printf(
wp_kses_post( __( 'Thank you for confirming your address! Weve emailed confirmation links to the contributors you mentioned, and your pledge will show up in <a href=\"%s\">the directory</a> once one contributor confirms their participation.', 'wporg-5ftf' ) ),
esc_url( $directory_url )
);
} else {
printf(
wp_kses_post( __( 'Thank you for confirming your address! If you have confirmed contributors, your pledge is visible in <a href=\"%s\">the directory</a> again. Otherwise, your pledge wiill show up once one contributor confirms their participation.', 'wporg-5ftf' ) ),
esc_url( $directory_url )
);
}
?>
</p>
@ -54,11 +62,11 @@ use WP_Post;
<form action="" method="get">
<input type="hidden" name="pledge_id" value="<?php echo esc_attr( $pledge_id ); ?>" />
<input type="hidden" name="action" value="resend_pledge_confirmation" />
<p>
<input
type="submit"
name="resend_pledge_confirmation"
value="Resend Confirmation"
/>
</p>

View file

@ -23,6 +23,7 @@ require __DIR__ . '/partial-result-messages.php';
wp_nonce_field( 'manage_pledge_' . $pledge_id );
require get_views_path() . 'inputs-pledge-org-info.php';
require get_views_path() . 'inputs-pledge-org-email.php';
?>
<div>

View file

@ -25,9 +25,16 @@ use WP_Post;
aria-describedby="5ftf-pledge-email-help"
<?php echo $readonly ? 'readonly' : ''; ?>
/>
<p id="5ftf-pledge-email-help">
<?php esc_html_e( 'This address will be used to confirm your organizations contribution profile, and later manage any changes. Please make sure that its a group address (e.g., wp-contributors@example.com) so that it persists across employee transitions.', 'wporg-5ftf' ); ?>
</p>
<div id="5ftf-pledge-email-help">
<p>
<?php esc_html_e( 'This address will be used to confirm your organizations contribution profile, and later manage any changes. Please make sure that its a group address (e.g., wp-contributors@example.com) so that it persists across employee transitions.', 'wporg-5ftf' ); ?>
</p>
<?php if ( ! empty( $data['org-pledge-email'] ) ) : ?>
<p>
<?php esc_html_e( 'If you change this email, you will need to confirm the new email. Your pledge will be unpublished until the new email is confirmed.', 'wporg-5ftf' ); ?>
</p>
<?php endif; ?>
</div>
<?php if ( is_admin() ) : ?>
<?php if ( $data['pledge-email-confirmed'] ) : ?>