PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
← All changes | includes/admin/emails/class-donor-note-email.php +40 -27 2.3.0 → 4.17.0 View file →
@@ -1,12 +1,11 @@
1 1 <?php
2 2 /**
3 3 * Donor Note Email
4 4 *
5 - *
6 5 * @package Give
7 6 * @subpackage Classes/Emails
8 - * @copyright Copyright (c) 2018, WordImpress
7 + * @copyright Copyright (c) 2018, GiveWP
9 8 * @license https://opensource.org/licenses/gpl-license GNU Public License
10 9 * @since 2.3.0
11 10 */
12 11
@@ -36,29 +35,31 @@
36 35 public function init() {
37 36 // Initialize empty payment.
38 37 $this->payment = new Give_Payment( 0 );
39 38
40 - $this->load( array(
41 - 'id' => 'donor-note',
42 - 'label' => __( 'Donor Note', 'give' ),
43 - 'description' => __( 'Sent to the donor when new donation note added to there donation.', 'give' ),
44 - 'notification_status' => 'enabled',
45 - 'recipient_group_name' => __( 'Donor', 'give' ),
46 - 'default_email_subject' => sprintf(
47 - esc_attr__( 'Note added to your %s donation from %s', 'give' ),
48 - '{donation}',
49 - '{date}'
50 - ),
51 - 'default_email_message' => sprintf(
52 - "Dear %s,\n\nA note has just been added to your donation:\n\n%s\n\nFor your reference, you may view your donation details by clicking the link below:\n%s\n\nThank you,\n%s",
53 - '{name}',
54 - '{donor_note}',
55 - '{receipt_link}',
56 - '{sitename}'
57 - ),
58 - 'default_email_header' => __( 'New Donation Note Added', 'give' ),
59 - 'form_metabox_setting' => false,
60 - ) );
39 + $this->load(
40 + array(
41 + 'id' => 'donor-note',
42 + 'label' => __( 'Donation Note', 'give' ),
43 + 'description' => __( 'Sent when a donation note is added to a donation payment.', 'give' ),
44 + 'notification_status' => 'enabled',
45 + 'recipient_group_name' => __( 'Donor', 'give' ),
46 + 'default_email_subject' => sprintf(
47 + esc_attr__( 'Note added to your %1$s donation from %2$s', 'give' ),
48 + '{donation}',
49 + '{date}'
50 + ),
51 + 'default_email_message' => sprintf(
52 + "Dear %s,\n\nA note has just been added to your donation:\n\n%s\n\nFor your reference, you may view your donation details by clicking the link below:\n%s\n\nThank you,\n%s",
53 + '{name}',
54 + '{donor_note}',
55 + '{receipt_link}',
56 + '{sitename}'
57 + ),
58 + 'default_email_header' => __( 'New Donation Note Added', 'give' ),
59 + 'form_metabox_setting' => false,
60 + )
61 + );
61 62
62 63 add_action( "give_{$this->config['id']}_email_notification", array( $this, 'send_note' ), 10, 2 );
63 64 }
64 65
@@ -71,15 +72,27 @@
71 72 * @param int $donation_id Donation ID.
72 73 * @param int $note_id Donor comment.
73 74 */
74 75 public function send_note( $note_id, $donation_id ) {
76 + if ( ! $note_id || ! $donation_id ) {
77 + wp_die(
78 + esc_html__( 'Cheatin&#8217; uh?', 'give' ),
79 + esc_html__( 'Error', 'give' ),
80 + array(
81 + 'response' => 400,
82 + )
83 + );
84 + }
85 +
75 86 $this->recipient_email = give_get_donation_donor_email( $donation_id );
76 87
77 88 // Send email.
78 - $this->send_email_notification( array(
79 - 'payment_id' => $donation_id,
80 - 'note_id' => $note_id,
81 - ) );
89 + $this->send_email_notification(
90 + array(
91 + 'payment_id' => $donation_id,
92 + 'note_id' => $note_id,
93 + )
94 + );
82 95 }
83 96 }
84 97
85 98 endif; // End class_exists check