Esempio n. 1
0
/**
 * Sends the Admin Sale Notification Email
 *
 * @since 1.0
 *
 * @param int   $payment_id   Payment ID (default: 0)
 * @param array $payment_data Payment Meta and Data
 *
 * @return void
 */
function give_admin_email_notice($payment_id = 0, $payment_data = array())
{
    $payment_id = absint($payment_id);
    if (empty($payment_id)) {
        return;
    }
    if (!give_get_payment_by('id', $payment_id)) {
        return;
    }
    $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);
    $subject = give_get_option('donation_notification_subject', sprintf(__('New Donation - Payment #%1$s', 'give'), $payment_id));
    $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id);
    $subject = give_do_email_tags($subject, $payment_id);
    $headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n";
    $headers .= "Reply-To: " . $from_email . "\r\n";
    //$headers  .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=utf-8\r\n";
    $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data);
    $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data);
    $message = give_get_donation_notification_body_content($payment_id, $payment_data);
    $emails = Give()->emails;
    $emails->__set('from_name', $from_name);
    $emails->__set('from_email', $from_email);
    $emails->__set('headers', $headers);
    $emails->__set('heading', __('New Donation!', 'give'));
    $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
}
Esempio n. 2
0
/**
 * Send Offline Donation Admin Notice
 *
 * @description Sends a notice to site admins about the pending donation
 *
 * @since       1.0
 *
 * @param int $payment_id
 *
 * @return void
 *
 */
function give_offline_send_admin_notice($payment_id = 0)
{
    /* Send an email notification to the admin */
    $admin_email = give_get_admin_notice_emails();
    $user_info = give_get_payment_meta_user_info($payment_id);
    if (isset($user_info['id']) && $user_info['id'] > 0) {
        $user_data = get_userdata($user_info['id']);
        $name = $user_data->display_name;
    } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
        $name = $user_info['first_name'] . ' ' . $user_info['last_name'];
    } else {
        $name = $user_info['email'];
    }
    $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)));
    $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id);
    $admin_message = __('Dear Admin,', 'give') . "\n\n" . __('An offline donation has been made', 'give') . ".\n\n";
    $order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id);
    $admin_message .= __('Donor: ', 'give') . " " . html_entity_decode($name, ENT_COMPAT, 'UTF-8') . "\n";
    $admin_message .= __('Amount: ', 'give') . " " . html_entity_decode($amount, ENT_COMPAT, 'UTF-8') . "\n\n";
    $admin_message .= __('There is a new pending donation awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give') . "\n\n";
    $admin_message .= sprintf(__('View Donation Details: %s.', 'give'), $order_url) . "\n\n";
    $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
    $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
    $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
    wp_mail($admin_email, $admin_subject, $admin_message, $admin_headers, $attachments);
}
Esempio n. 3
0
/**
 * Send Offline Donation Admin Notice
 *
 * Sends a notice to site admins about the pending donation
 *
 * @since       1.0
 *
 * @param int $payment_id
 *
 * @return void
 *
 */
function give_offline_send_admin_notice($payment_id = 0)
{
    /* Send an email notification to the admin */
    $admin_email = give_get_admin_notice_emails();
    $user_info = give_get_payment_meta_user_info($payment_id);
    if (isset($user_info['id']) && $user_info['id'] > 0) {
        $user_data = get_userdata($user_info['id']);
        $name = $user_data->display_name;
    } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
        $name = $user_info['first_name'] . ' ' . $user_info['last_name'];
    } else {
        $name = $user_info['email'];
    }
    $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)));
    $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id);
    $admin_message = esc_attr__('Dear Admin,', 'give') . "\n\n";
    $admin_message .= esc_attr__('An offline donation has been made on your website: ', 'give') . get_bloginfo('name') . ' ';
    $admin_message .= esc_attr__('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give') . "\n\n";
    $admin_message .= '<strong>' . esc_attr__('Donor: ', 'give') . '</strong>' . '{fullname}' . "\n";
    $admin_message .= '<strong>' . esc_attr__('Amount: ', 'give') . '</strong>' . '{amount}' . "\n\n";
    $admin_message .= sprintf('<a href="%1$s">%2$s</a>', admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id), esc_html__('Click Here to View and/or Update Donation Details', 'give')) . "\n\n";
    $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
    $admin_message = give_do_email_tags($admin_message, $payment_id);
    $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
    $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
    //Send Email
    $emails = Give()->emails;
    if (!empty($admin_headers)) {
        $emails->__set('headers', $admin_headers);
    }
    $emails->send($admin_email, $admin_subject, $admin_message, $attachments);
}