Is Automatic Email Notification Possible?

Hello Friendly Forum!

Using the Fundraising plugin, when someone makes a donation, I receive an email from Paypal letting me know. However, I’m not the one in the office that is in charge of sending out certificates.

I was wondering if there’s a way to get the system to automatically email a given address when a pledge is received. Perhaps it’s been requested before, but if not, I’m hoping it’s easy to implement.

Thanks so much!

Mindy :slight_smile:

  • Mindy
    • WPMU DEV Initiate

    Hi Maniu,

    Thanks for pointing me in the right direction. I tried to add a new function to the fundraiser.php file, called within the update_pledge function just after the function call to thank the donor:

    $this->create_thank_you($funder_id,$transaction);
    $this->send_admin_notification($funder_id,$transaction,$post_title);

    The send_admin_notification() function is below:

    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 = "donations@saveelephant.@George Michael";
    $subject = "Donation Received from " . $donor;
    $headers = 'From: "SEF Donations" <orders@saveelephant.org>';
    $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);
    }
    }

    In my test environment, this breaks the site. Any idea as to what’s causing the trouble?

    Thanks for your help,

    Mindy :slight_smile:

  • Maniu
    • Developer

    Hey @mindy

    There were few small mistakes (& instead of $, unnecessary ;, missing :wink:

    here is fixed version:

    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 = "donations@saveelephant.@George Michael";
    $subject = "Donation Received from " . $donor;
    $headers = 'From: "SEF Donations" <orders@saveelephant.org>';
    $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);
    }
    }

    Hope this helps!

    Thanks,

    Maniu

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.