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-new-donation-email.php +29 -16 2.3.0 → 4.17.0 View file →
@@ -3,12 +3,11 @@
3 3 * New Donation Email
4 4 *
5 5 * Donation Notification will be sent to recipient(s) when new donation received except offline donation.
6 6 *
7 - *
8 7 * @package Give
9 8 * @subpackage Classes/Emails
10 - * @copyright Copyright (c) 2016, WordImpress
9 + * @copyright Copyright (c) 2016, GiveWP
11 10 * @license https://opensource.org/licenses/gpl-license GNU Public License
12 11 * @since 2.0
13 12 */
14 13
@@ -38,19 +37,21 @@
38 37 public function init() {
39 38 // Initialize empty payment.
40 39 $this->payment = new Give_Payment( 0 );
41 40
42 - $this->load( array(
43 - 'id' => 'new-donation',
44 - 'label' => __( 'New Donation', 'give' ),
45 - 'description' => __( 'Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give' ),
46 - 'has_recipient_field' => true,
47 - 'notification_status' => 'enabled',
48 - 'form_metabox_setting' => true,
49 - 'default_email_subject' => esc_attr__( 'New Donation - #{payment_id}', 'give' ),
50 - 'default_email_message' => ( false !== give_get_option( 'new-donation_email_message' ) ) ? give_get_option( 'new-donation_email_message' ) : give_get_default_donation_notification_email(),
51 - 'default_email_header' => __( 'New Donation!', 'give' ),
52 - ) );
41 + $this->load(
42 + array(
43 + 'id' => 'new-donation',
44 + 'label' => __( 'New Donation', 'give' ),
45 + 'description' => __( 'Sent to designated recipient(s) when a new donation is received or a pending donation is marked as complete.', 'give' ),
46 + 'has_recipient_field' => true,
47 + 'notification_status' => 'enabled',
48 + 'form_metabox_setting' => true,
49 + 'default_email_subject' => esc_attr__( 'New Donation - #{payment_id}', 'give' ),
50 + 'default_email_message' => ( false !== give_get_option( 'new-donation_email_message' ) ) ? give_get_option( 'new-donation_email_message' ) : give_get_default_donation_notification_email(),
51 + 'default_email_header' => __( 'New Donation!', 'give' ),
52 + )
53 + );
53 54
54 55 add_action( "give_{$this->config['id']}_email_notification", array( $this, 'setup_email_notification' ) );
55 56 }
56 57
@@ -240,15 +241,27 @@
240 241 */
241 242 public function setup_email_notification( $payment_id ) {
242 243 $this->payment = new Give_Payment( $payment_id );
243 244
245 + if ( ! $this->payment->ID ) {
246 + wp_die(
247 + esc_html__( 'Cheatin’ uh?', 'give' ),
248 + esc_html__( 'Error', 'give' ),
249 + array(
250 + 'response' => 400,
251 + )
252 + );
253 + }
254 +
244 255 // Set email data.
245 256 $this->setup_email_data();
246 257
247 258 // Send email.
248 - $this->send_email_notification( array(
249 - 'payment_id' => $payment_id,
250 - ) );
259 + $this->send_email_notification(
260 + array(
261 + 'payment_id' => $payment_id,
262 + )
263 + );
251 264 }
252 265 }
253 266
254 267 endif; // End class_exists check