Home / Disable / Add User Email To Donation Summary
Duplicate Snippet

Embed Snippet on Your Site

Add User Email To Donation Summary

This will allow - among other places - for the user email to be displayed on a donor receipt page.

Code Preview
php
<?php
<?php
/**
 * Displays the donation summary.
 *
 * Override this template by copying it to yourtheme/charitable/donation-receipt/summary.php
 *
 * @author  WP Charitable LLC
 * @package Charitable/Templates/Donation Receipt
 * @since   1.0.0
 * @version 1.4.7
 */
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
/* @var Charitable_Donation */
$donation = $view_args['donation'];
$amount   = $donation->get_total();
/* new to template */
$donor = $donation->get_donor();
$email = $donor->data->email;
?>
<dl class="donation-summary">
	<dt class="donation-id"><?php _e( 'Donation Number:', 'charitable' ); ?></dt>
	<dd class="donation-summary-value"><?php echo $donation->get_number(); ?></dd>
	<dt class="donation-date"><?php _e( 'Date:', 'charitable' ); ?></dt>
	<dd class="donation-summary-value"><?php echo $donation->get_date(); ?></dd>
	<dt class="donation-total"> <?php _e( 'Email:', 'charitable' ); ?></dt>
	<dd class="donation-summary-value"><?php echo $email; ?></dd>
	<dt class="donation-total"> <?php _e( 'Total:', 'charitable' ); ?></dt>
	<dd class="donation-summary-value">
	<?php
		/**
		 * Filter the total donation amount.
		 *
		 * @since  1.5.0
		 *
		 * @param  string              $amount   The default amount to display.
		 * @param  float               $total    The total, unformatted.
		 * @param  Charitable_Donation $donation The Donation object.
		 * @param  string              $context  The context in which this is being shown.
		 * @return string
		 */
		echo apply_filters( 'charitable_donation_receipt_donation_amount', charitable_format_money( $amount ), $amount, $donation, 'summary' )
	?>
	</dd>
	<dt class="donation-method"><?php _e( 'Payment Method:', 'charitable' ); ?></dt>
	<dd class="donation-summary-value"><?php echo $donation->get_gateway_label(); ?></dd>
</dl>

Comments

Add a Comment