mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-17 15:45:44 +03:00
Send contributors the confirmation email when created by the ajax endpoint
This will only send the email for published pledges.
This commit is contained in:
parent
f7a253027c
commit
d0dc2f0a14
2 changed files with 10 additions and 2 deletions
|
@ -39,6 +39,7 @@ function handler() {
|
|||
break;
|
||||
|
||||
case 'add-contributor':
|
||||
$pledge = get_post( $pledge_id );
|
||||
$new_contributors = PledgeForm\parse_contributors( $_POST['contributors'] );
|
||||
if ( is_wp_error( $new_contributors ) ) {
|
||||
wp_die( wp_json_encode( [
|
||||
|
@ -46,7 +47,12 @@ function handler() {
|
|||
'message' => $new_contributors->get_error_message(),
|
||||
] ) );
|
||||
}
|
||||
Contributor\add_pledge_contributors( $pledge_id, $new_contributors );
|
||||
$contributor_ids = Contributor\add_pledge_contributors( $pledge_id, $new_contributors );
|
||||
if ( 'publish' === $pledge->post_status ) {
|
||||
foreach ( $contributor_ids as $contributor_id ) {
|
||||
PledgeForm\send_contributor_confirmation_emails( $pledge_id, $contributor_id );
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch all contributors, now that the new ones have been added.
|
||||
$contributors = Contributor\get_pledge_contributors_data( $pledge_id );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue