|
<?php |
|
|
|
add_action( 'give_email_tags', 'register_email_custom_tributes_tags' ); |
|
function register_email_custom_tributes_tags($email_tags) |
|
{ |
|
$email_tags = array_merge( |
|
$email_tags, |
|
[ |
|
[ |
|
'tag' => 'honoree_fullname', // The tag name. |
|
'desc' => __( 'The full name of the honoree.', 'give-tributes' ), |
|
'func' => 'honoree_fullname_email_tag', // Callback to function below. |
|
'context' => 'donation', // This tag can be for both admin and donor notifications. |
|
'is_admin' => false, // default is false. This is here to simply display it as an option. |
|
], |
|
[ |
|
'tag' => 'ecard_recipient', // The tag name. |
|
'desc' => __( 'The name of the ecard recipient', 'give-tributes' ), |
|
'func' => 'ecard_recepient_email_tag', // Callback to function below. |
|
'context' => 'donation', // This tag can be for both admin and donor notifications. |
|
'is_admin' => false, // default is false. This is here to simply display it as an option. |
|
], |
|
[ |
|
'tag' => 'ecard_email', // The tag name. |
|
'desc' => __( 'The email of the ecard recipient', 'give-tributes' ), |
|
'func' => 'ecard_email_tag', // Callback to function below. |
|
'context' => 'donation', // This tag can be for both admin and donor notifications. |
|
'is_admin' => false, // default is false. This is here to simply display it as an option. |
|
], |
|
] |
|
); |
|
|
|
return $email_tags; |
|
} |
|
|
|
function honoree_fullname_email_tag( $tag_args ) { |
|
|
|
$payment_id = $tag_args['payment_id']; |
|
|
|
// Honoree First name. |
|
$honoree_first_name = give_get_meta( $payment_id, '_give_tributes_first_name', true ); |
|
$honoree_first_name = ! empty( $honoree_first_name ) ? $honoree_first_name : ''; |
|
// Honoree last name. |
|
$honoree_last_name = give_get_meta( $payment_id, '_give_tributes_last_name', true ); |
|
$honoree_last_name = ! empty( $honoree_last_name ) ? $honoree_last_name : ''; |
|
// Prepare Honoree Full name. |
|
if ( ! empty( $honoree_first_name ) || ! empty( $honoree_last_name ) ) { |
|
$honoree_full_name = $honoree_first_name . ' ' . $honoree_last_name; |
|
} else { |
|
$honoree_full_name = ''; |
|
} |
|
return ! empty( $honoree_full_name ) ? ucfirst( $honoree_full_name ) : ''; |
|
} |
|
|
|
function ecard_recepient_email_tag( $tag_args ) { |
|
|
|
$payment_id = $tag_args['payment_id']; |
|
|
|
// Honoree First name. |
|
$ecard_first_name = give_get_meta( $payment_id, '_give_tributes_ecard_notify_first_name', true ); |
|
$ecard_first_name = ! empty( $ecard_first_name ) ? $ecard_first_name : ''; |
|
// Honoree last name. |
|
$ecard_last_name = give_get_meta( $payment_id, '_give_tributes_ecard_notify_last_name', true ); |
|
$ecard_last_name = ! empty( $ecard_last_name ) ? $ecard_last_name : ''; |
|
// Prepare Honoree Full name. |
|
if ( ! empty( $ecard_first_name ) || ! empty( $ecard_last_name ) ) { |
|
$ecard_full_name = $ecard_first_name . ' ' . $ecard_last_name; |
|
} else { |
|
$ecard_full_name = ''; |
|
} |
|
return ! empty( $ecard_full_name ) ? ucfirst( $ecard_full_name ) : ''; |
|
} |
|
|
|
function ecard_email_tag( $tag_args ) { |
|
|
|
$payment_id = $tag_args['payment_id']; |
|
|
|
// Ecard email. |
|
$ecard_email = give_get_meta( $payment_id, '_give_tributes_honoree_ecard_email', true ); |
|
return ! empty( $ecard_email ) ? ( $ecard_email ) : ''; |
|
} |