mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-04 18:05:45 +03:00
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:
parent
544fe39199
commit
80b88399ae
6 changed files with 139 additions and 65 deletions
|
@ -280,10 +280,11 @@ function save_pledge( $pledge_id, $pledge ) {
|
|||
|
||||
save_pledge_meta( $pledge_id, $submitted_meta );
|
||||
|
||||
// Fired if the "Resend Confirmation" button was clicked in wp-admin.
|
||||
if ( filter_input( INPUT_POST, 'resend-pledge-confirmation' ) ) {
|
||||
Email\send_pledge_confirmation_email(
|
||||
filter_input( INPUT_GET, 'resend-pledge-id', FILTER_VALIDATE_INT ),
|
||||
get_page_by_path( 'for-organizations' )->ID
|
||||
get_page_by_path( 'manage-pledge' )->ID
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -350,8 +351,15 @@ function update_generated_meta( $meta_id, $object_id, $meta_key, $_meta_value )
|
|||
update_post_meta( $object_id, META_PREFIX . 'org-domain', $domain );
|
||||
break;
|
||||
|
||||
case META_PREFIX . 'pledge-email':
|
||||
case META_PREFIX . 'org-pledge-email':
|
||||
$landing_page = get_page_by_path( 'manage-pledge' )->ID;
|
||||
Email\send_pledge_confirmation_email( $object_id, $landing_page );
|
||||
delete_post_meta( $object_id, META_PREFIX . 'pledge-email-confirmed' );
|
||||
// Flip pledge back to pending.
|
||||
wp_update_post( array(
|
||||
'ID' => $object_id,
|
||||
'post_status' => 'pending',
|
||||
) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue