← All changes
|
includes/admin/emails/class-offline-donation-instruction-email.php
+7
-5
4.16.8
→
4.18.0.1
View file →
| @@ -211,8 +211,9 @@ | ||
| 211 | 211 | |
| 212 | 212 | /** |
| 213 | 213 | * Setup email notification. |
| 214 | 214 | * |
| 215 | + * @since 4.18.0 Check the gateway from meta before loading the legacy payment object. | |
| 215 | 216 | * @since 2.0 |
| 216 | 217 | * @access public |
| 217 | 218 | * |
| 218 | 219 | * @param int $payment_id |
| @@ -217,8 +218,14 @@ | ||
| 217 | 218 | * |
| 218 | 219 | * @param int $payment_id |
| 219 | 220 | */ |
| 220 | 221 | public function setup_email_notification( $payment_id ) { |
| 222 | + // Exit if not donation was not with offline donation. Checked from meta first so every | |
| 223 | + // non-offline donation does not pay for building a Give_Payment on insert. | |
| 224 | + if ( 'offline' !== give_get_payment_gateway( $payment_id ) ) { | |
| 225 | + return; | |
| 226 | + } | |
| 227 | + | |
| 221 | 228 | $this->payment = new Give_Payment( $payment_id ); |
| 222 | 229 | |
| 223 | 230 | if ( ! $this->payment->ID ) { |
| 224 | 231 | wp_die( |
| @@ -227,13 +234,8 @@ | ||
| 227 | 234 | array( |
| 228 | 235 | 'response' => 400, |
| 229 | 236 | ) |
| 230 | 237 | ); |
| 231 | - } | |
| 232 | - | |
| 233 | - // Exit if not donation was not with offline donation. | |
| 234 | - if ( 'offline' !== $this->payment->gateway ) { | |
| 235 | - return; | |
| 236 | 238 | } |
| 237 | 239 | |
| 238 | 240 | // Set email data. |
| 239 | 241 | $this->setup_email_data(); |