Created
February 5, 2015 15:12
-
-
Save JudeRosario/659c89f0b58e9d3223db to your computer and use it in GitHub Desktop.
Fundraising Feature : Send Admin Notifications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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