edd_apply_email_template

Applies the Chosen Email Template.

Description

(string) edd_apply_email_template( (string) $body, (int) $payment_id, (array) $payment_data = array() ); 

Returns (string)

$email Formatted email with the template applied

Parameters (3)

0. $body (string)
The contents of the receipt email
1. $payment_id (int)
The ID of the payment we are sending a receipt for
2. $payment_data — Optional. (array) => array()
An array of meta information for the payment

Usage

  1. if ( !function_exists( 'edd_apply_email_template' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'easy-digital-downloads/includes/deprecated-functions.php'; 
  3.  
  4. // The contents of the receipt email 
  5. $body = ''; 
  6.  
  7. // The ID of the payment we are sending a receipt for 
  8. $payment_id = -1; 
  9.  
  10. // An array of meta information for the payment 
  11. $payment_data = array(); 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = edd_apply_email_template($body, $payment_id, $payment_data); 
  15.  

Defined (1)

The function is defined in the following location(s).

/includes/deprecated-functions.php  
  1. function edd_apply_email_template( $body, $payment_id, $payment_data=array() ) { 
  2. global $edd_options; 
  3.  
  4. $backtrace = debug_backtrace(); 
  5.  
  6. _edd_deprecated_function( __FUNCTION__, '2.0', '', $backtrace ); 
  7.  
  8. $template_name = isset( $edd_options['email_template'] ) ? $edd_options['email_template'] : 'default'; 
  9. $template_name = apply_filters( 'edd_email_template', $template_name, $payment_id ); 
  10.  
  11. if ( $template_name == 'none' ) { 
  12. if ( is_admin() ) 
  13. $body = edd_email_preview_template_tags( $body ); 
  14.  
  15. return $body; // Return the plain email with no template 
  16.  
  17. ob_start(); 
  18.  
  19.  
  20. $template = ob_get_clean(); 
  21.  
  22. if ( is_admin() ) 
  23. $body = edd_email_preview_template_tags( $body ); 
  24.  
  25. $body = apply_filters( 'edd_purchase_receipt_' . $template_name, $body ); 
  26.  
  27. $email = str_replace( '{email}', $body, $template ); 
  28.  
  29. return $email; 
  30.