← All changes
|
includes/admin/emails/class-new-offline-donation-email.php
+7
-5
4.16.6
→
4.18.0
View file →
| @@ -245,8 +245,9 @@ | ||
| 245 | 245 | |
| 246 | 246 | /** |
| 247 | 247 | * Setup email notification. |
| 248 | 248 | * |
| 249 | + * @since 4.18.0 Check the gateway from meta before loading the legacy payment object. | |
| 249 | 250 | * @since 2.0 |
| 250 | 251 | * @access public |
| 251 | 252 | * |
| 252 | 253 | * @param int $payment_id |
| @@ -251,8 +252,14 @@ | ||
| 251 | 252 | * |
| 252 | 253 | * @param int $payment_id |
| 253 | 254 | */ |
| 254 | 255 | public function setup_email_notification( $payment_id ) { |
| 256 | + // Exit if not donation was not with offline donation. Checked from meta first so every | |
| 257 | + // non-offline donation does not pay for building a Give_Payment on insert. | |
| 258 | + if ( 'offline' !== give_get_payment_gateway( $payment_id ) ) { | |
| 259 | + return; | |
| 260 | + } | |
| 261 | + | |
| 255 | 262 | $this->payment = new Give_Payment( $payment_id ); |
| 256 | 263 | |
| 257 | 264 | if ( ! $this->payment->ID ) { |
| 258 | 265 | wp_die( |
| @@ -261,13 +268,8 @@ | ||
| 261 | 268 | array( |
| 262 | 269 | 'response' => 400, |
| 263 | 270 | ) |
| 264 | 271 | ); |
| 265 | - } | |
| 266 | - | |
| 267 | - // Exit if not donation was not with offline donation. | |
| 268 | - if ( 'offline' !== $this->payment->gateway ) { | |
| 269 | - return; | |
| 270 | 272 | } |
| 271 | 273 | |
| 272 | 274 | // Set email data. |
| 273 | 275 | $this->setup_email_data(); |