| 1 |
<?php |
| 2 |
/** |
| 3 |
* Email Actions. |
| 4 |
* |
| 5 |
* @package Give |
| 6 |
* @subpackage Emails |
| 7 |
* @copyright Copyright (c) 2016, GiveWP |
| 8 |
* @license https://opensource.org/licenses/gpl-license GNU Public License |
| 9 |
* @since 1.0 |
| 10 |
*/ |
| 11 |
|
| 12 |
// Exit if accessed directly. |
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Triggers a donation receipt to be sent after the payment status is updated. |
| 19 |
* |
| 20 |
* @since 1.0 |
| 21 |
* |
| 22 |
* @param int $payment_id Payment ID |
| 23 |
* |
| 24 |
* @return void |
| 25 |
*/ |
| 26 |
function give_trigger_donation_receipt( $payment_id ) { |
| 27 |
// Make sure we don't send a receipt while editing a donation. |
| 28 |
if ( ! is_numeric( $payment_id ) ) { |
| 29 |
return; |
| 30 |
} |
| 31 |
|
| 32 |
// Send email. |
| 33 |
give_email_donation_receipt( $payment_id ); |
| 34 |
} |
| 35 |
|
| 36 |
add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999, 1 ); |
| 37 |
|