Trigger an email on user-initiated pledge deactivation

This commit is contained in:
Kelly Dwan 2019-12-09 10:52:50 -05:00
parent 7024cf3b2e
commit dbe5868a41
No known key found for this signature in database
GPG key ID: 8BA5575F3D11575D
3 changed files with 49 additions and 11 deletions

View file

@ -154,3 +154,25 @@ function send_manage_pledge_link( $pledge_id ) {
return $result;
}
/**
* Email pledge manager to notify that the pledge has been removed.
*
* @param WP_Post $pledge The pledge object, used to add the title now that the pledge itself has been deleted.
*
* @return bool
*/
function send_pledge_deactivation_email( $pledge ) {
$message = sprintf(
"Your organization, %s, has been removed from the Five for the Future listing.\n\n" .
'Please reply to this email if this was a mistake.',
$pledge->post_title
);
return send_email(
$pledge->{'5ftf_org-pledge-email'},
'Pledge removed from Five for the Future',
$message,
$pledge->ID
);
}