Skip to content

Instantly share code, notes, and snippets.

@JudeRosario
Created February 5, 2015 15:12
Show Gist options
  • Save JudeRosario/659c89f0b58e9d3223db to your computer and use it in GitHub Desktop.
Save JudeRosario/659c89f0b58e9d3223db to your computer and use it in GitHub Desktop.
Fundraising Feature : Send Admin Notifications
function send_admin_notification($funder_id, $trans = false, $fund) {
if($trans != false) {
$donor = $trans['first_name'] . ' ' . $trans['last_name'];
$donation_amount = $this->format_currency('',$trans['gross'], 1);
$donor_email = $trans['payer_email'];
$recurring = 'One-Time';
if(isset($trans['cycle'])) {
$recurring = $trans['cycle'];
}
$to = the_author_meta( 'user_email', $funder_id )
$subject = "Donation Received from " . $donor;
$headers = 'From: "Fundraising" <[email protected]>';
$message = "We have received a new donation from " . $donor . "!\n";
$message .= "Amount: " . $donation_amount . "\n";
$message .= "Fund: " . $fund . "\n";
$message .= "Donor Email: " . $donor_email . "\n";
$message .= "Recurrence: " . $recurring;
//send email notification
wp_mail($to, $subject, $message, $headers);
}
// Add this code
$this->create_thank_you($funder_id,$transaction);
// After where it says
$this->send_admin_notification($funder_id,$transaction,$post_title);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment