/**
 * Prevent the donor notification email but keep the admin notification email functionality.
 *
 * @param $payment_id
 */
function my123_give_remove_donor_notification($payment_id)
{
    remove_action('give_complete_donation', 'give_trigger_donation_receipt', 999, 1);
    //Remove these lines to stop triggering the admin notification.
    $payment_data = give_get_payment_meta($payment_id);
    if (!give_admin_notices_disabled($payment_id)) {
        do_action('give_admin_donation_email', $payment_id, $payment_data);
    }
}
Example #2
0
/**
 * Email the payment confirmation to the buyer in a customizable Donation Receipt
 *
 * @since 1.0
 *
 * @param int  $payment_id   Payment ID
 * @param bool $admin_notice Whether to send the admin email notification or not (default: true)
 *
 * @return void
 */
function give_email_donation_receipt($payment_id, $admin_notice = true)
{
    $payment_data = give_get_payment_meta($payment_id);
    $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
    $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
    $from_email = give_get_option('from_email', get_bloginfo('admin_email'));
    $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
    $to_email = give_get_payment_user_email($payment_id);
    $subject = give_get_option('donation_subject', __('Donation Receipt', 'give'));
    $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id);
    $subject = give_do_email_tags($subject, $payment_id);
    $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data);
    $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id);
    $emails = Give()->emails;
    $emails->__set('from_name', $from_name);
    $emails->__set('from_email', $from_email);
    $emails->__set('heading', __('Donation Receipt', 'give'));
    $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
    $emails->__set('headers', $headers);
    $emails->send($to_email, $subject, $message, $attachments);
    if ($admin_notice && !give_admin_notices_disabled($payment_id)) {
        do_action('give_admin_sale_notice', $payment_id, $payment_data);
    }
}