function dgx_donate_send_donation_notification($donationID)
{
    $fromEmail = get_option('dgx_donate_reply_email');
    $subject = "[Seamless Donations] " . __('A donation has been received', 'dgx-donate');
    $body = __('A donation has been received.  Here are some details about the donation.', 'dgx-donate') . "\n";
    $body .= "\n";
    $body .= "Donor:\n";
    $firstName = get_post_meta($donationID, '_dgx_donate_donor_first_name', true);
    $lastName = get_post_meta($donationID, '_dgx_donate_donor_last_name', true);
    $city = get_post_meta($donationID, '_dgx_donate_donor_city', true);
    $state = get_post_meta($donationID, '_dgx_donate_donor_state', true);
    $zip = get_post_meta($donationID, '_dgx_donate_donor_zip', true);
    $donorEmail = get_post_meta($donationID, '_dgx_donate_donor_email', true);
    $body .= "{$firstName} {$lastName}\n";
    $body .= "{$city} {$state} {$zip}\n";
    $body .= "{$donorEmail}\n";
    $body .= "\n";
    $tributeGift = get_post_meta($donationID, '_dgx_donate_tribute_gift', true);
    if (!empty($tributeGift)) {
        $body .= __('NOTE:  The donor is making this donation in honor of / in memory of someone.', 'dgx-donate') . " ";
        $body .= __('Please see the donation details (using the link below) for more information.', 'dgx-donate') . "\n";
        $body .= "\n";
    }
    $employer_match = get_post_meta($donationID, '_dgx_donate_employer_match', true);
    if (!empty($employer_match)) {
        $body .= __('NOTE:  The donor is making this donation with an employer match.', 'dgx-donate') . " ";
        $body .= __('Please see the donation details (using the link below) for more information.', 'dgx-donate') . "\n";
        $body .= "\n";
    }
    $amount = get_post_meta($donationID, '_dgx_donate_amount', true);
    $currency_code = dgx_donate_get_donation_currency_code($donationID);
    $formattedDonationAmount = dgx_donate_get_plain_formatted_amount($amount, 2, $currency_code, true);
    $body .= __('Donation:', 'dgx-donate') . "\n";
    $body .= __('Amount:', 'dgx-donate') . " {$formattedDonationAmount}\n";
    $body .= "\n";
    $body .= __('Click on the following link to view all details for this donation:', 'dgx-donate') . "\n";
    $secureDonateLink = dgx_donate_get_donation_detail_link($donationID);
    $donateLink = str_replace("https:", "http:", $secureDonateLink);
    $body .= $donateLink;
    $body .= "\n";
    // Loop on addresses
    $notifyEmails = get_option('dgx_donate_notify_emails');
    $notifyEmailAr = explode(',', $notifyEmails);
    foreach ($notifyEmailAr as $notifyEmail) {
        $notifyEmail = trim($notifyEmail);
        if (!empty($notifyEmail)) {
            $headers = "From: {$fromEmail}\r\n";
            $mail_sent = wp_mail($notifyEmail, $subject, $body, $headers);
            if (!$mail_sent) {
                dgx_donate_debug_log("Error: Could NOT send mail.");
                dgx_donate_debug_log("Subject: {$subject}");
                dgx_donate_debug_log("To Email: {$notifyEmail}");
            }
        }
    }
}
示例#2
0
 // Donor City, Donor State, Donor Zip, OK to Add to Mailing List (YES/NO)
 if ($firstOne) {
     header("Content-type: text/csv");
     header("Content-Disposition: attachment; filename=export.csv");
     echo "\"Date\",\"Time\",\"First Name\",\"Last Name\",\"Amount\",\"Currency\",\"Repeating\",";
     echo "\"Designated Fund\",\"Gift Item\",\"Phone\",\"Email\",\"Address\",\"Address 2\",";
     echo "\"City\",\"State/Prov\",\"Postal Code\",\"Country\",\"Employer\",\"Occupation\",";
     echo "\"OK to Add to Mailing List\"\n";
     $firstOne = false;
 }
 $time = get_post_meta($donationID, '_dgx_donate_time', true);
 $firstName = get_post_meta($donationID, '_dgx_donate_donor_first_name', true);
 $lastName = get_post_meta($donationID, '_dgx_donate_donor_last_name', true);
 $amount = get_post_meta($donationID, '_dgx_donate_amount', true);
 $currency_code = dgx_donate_get_donation_currency_code($donationID);
 $formatted_amount = dgx_donate_get_plain_formatted_amount($amount, 2, $currency_code, false);
 $repeating = get_post_meta($donationID, '_dgx_donate_repeating', true);
 if (empty($repeating)) {
     $repeating = "No";
 } else {
     $repeating = "Yes";
 }
 $designatedFundName = "Undesignated";
 $designated = get_post_meta($donationID, '_dgx_donate_designated', true);
 if (!empty($designated)) {
     $designatedFundName = get_post_meta($donationID, '_dgx_donate_designated_fund', true);
 }
 $gift_item_id = get_post_meta($donationID, '_dgx_donate_gift_item_id', true);
 $gift_item_title = "";
 if (!empty($gift_item_id)) {
     $gift_item_title = get_the_title($gift_item_id);