edd_admin_email_notice

Sends the Admin Sale Notification Email.

Description

edd_admin_email_notice( (int) $payment_id = 0, (array) $payment_data = array() ); 

Parameters (2)

0. $payment_id — Optional. (int)
Payment ID (default: 0)
1. $payment_data — Optional. (array) => array()
Payment Meta and Data

Usage

  1. if ( !function_exists( 'edd_admin_email_notice' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'easy-digital-downloads/includes/emails/functions.php'; 
  3.  
  4. // Payment ID (default: 0) 
  5. $payment_id = -1; 
  6.  
  7. // Payment Meta and Data 
  8. $payment_data = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = edd_admin_email_notice($payment_id, $payment_data); 
  12.  

Defined (1)

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

/includes/emails/functions.php  
  1. function edd_admin_email_notice( $payment_id = 0, $payment_data = array() ) { 
  2.  
  3. $payment_id = absint( $payment_id ); 
  4.  
  5. if( empty( $payment_id ) ) { 
  6. return; 
  7.  
  8. if( ! edd_get_payment_by( 'id', $payment_id ) ) { 
  9. return; 
  10.  
  11. $from_name = edd_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); 
  12. $from_name = apply_filters( 'edd_purchase_from_name', $from_name, $payment_id, $payment_data ); 
  13.  
  14. $from_email = edd_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); 
  15. $from_email = apply_filters( 'edd_admin_sale_from_address', $from_email, $payment_id, $payment_data ); 
  16.  
  17. $subject = edd_get_option( 'sale_notification_subject', sprintf( __( 'New download purchase - Order #%1$s', 'easy-digital-downloads' ), $payment_id ) ); 
  18. $subject = apply_filters( 'edd_admin_sale_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); 
  19. $subject = edd_do_email_tags( $subject, $payment_id ); 
  20.  
  21. $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; 
  22. $headers .= "Reply-To: ". $from_email . "\r\n"; 
  23. //$headers .= "MIME-Version: 1.0\r\n"; 
  24. $headers .= "Content-Type: text/html; charset=utf-8\r\n"; 
  25. $headers = apply_filters( 'edd_admin_sale_notification_headers', $headers, $payment_id, $payment_data ); 
  26.  
  27. $attachments = apply_filters( 'edd_admin_sale_notification_attachments', array(), $payment_id, $payment_data ); 
  28.  
  29. $message = edd_get_sale_notification_body_content( $payment_id, $payment_data ); 
  30.  
  31. $emails = EDD()->emails; 
  32. $emails->__set( 'from_name', $from_name ); 
  33. $emails->__set( 'from_email', $from_email ); 
  34. $emails->__set( 'headers', $headers ); 
  35. $emails->__set( 'heading', __( 'New Sale!', 'easy-digital-downloads' ) ); 
  36.  
  37. $emails->send( edd_get_admin_notice_emails(), $subject, $message, $attachments ); 
  38.