Skip to content

Instantly share code, notes, and snippets.

@vodanh1213
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vodanh1213/3043a5047aa7501450e7 to your computer and use it in GitHub Desktop.
Save vodanh1213/3043a5047aa7501450e7 to your computer and use it in GitHub Desktop.
add_action('wdf_after_goal_complete', 'fundraiser_done_send_email');
function fundraiser_done_send_email($pledges)
{
$small_amount_emails = array();
$large_amount_emails = array();
foreach ($pledges as $pledge) {
$data = get_post_meta($pledge->ID, 'wdf_transaction', true);
if ($data['gross'] < 5) {
$small_amount_emails[] = $data['payer_email'];
} else {
$large_amount_emails[] = $data['payer_email'];
}
}
//this block for sending small donation amount
$small_amount_emails = array_unique($small_amount_emails);
$contents = "Chỉ dùng để thử nghiệm";
$subject = "Email thử nghiệm";
foreach ($small_amount_emails as $email) {
wp_mail($email, $subject, $contents, array(
"Content-type: text/html",
"From: My Name <myname@example.com>"
));
}
//this block for sending larger donation amount
$large_amount_emails = array_unique($large_amount_emails);
$contents = "Chỉ dùng để thử nghiệm";
$subject = "Email thử nghiệm";
foreach ($large_amount_emails as $email) {
wp_mail($email, $subject, $contents, array(
"Content-type: text/html",
"From: My Name <myname@example.com>"
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment