affiliate_id; $email = affwp_get_affiliate_email( $affiliate_id ); // email subject $subject = apply_filters( 'affwp_odfa_email_subject', __( 'The order details for your most recent referral', 'affiliatewp-order-details-for-affiliates' ) ); // get our message $message = $this->get_email_message( $referral, $affiliate_id ); // only send email to affiliates that are allowed to receive purchase details if ( affiliatewp_order_details_for_affiliates()->can_access_order_details( affwp_get_affiliate_user_id( $affiliate_id ) ) && $this->can_receive_email( $affiliate_id ) ) { // if EDD, use EDD's email class if ( 'edd' == $referral->context ) { EDD()->emails->send( $email, $subject, $message ); } else { add_filter( 'wp_mail_content_type', array( $this, 'set_html_content_type' ) ); affiliate_wp()->emails->send( $email, $subject, $message ); remove_filter( 'wp_mail_content_type', array( $this, 'set_html_content_type' ) ); } } } /** * The email message that is sent to the affiliate * * @since 1.0 * * @return void */ public function get_email_message( $referral = array(), $affiliate_id = 0 ) { $affwp_odfa = affiliatewp_order_details_for_affiliates(); $is_allowed = $affwp_odfa->order_details->allowed(); $affiliate_name = affiliate_wp()->affiliates->get_affiliate_name( $affiliate_id ); $order_number = $affwp_odfa->order_details->get( $referral, 'order_number' ); $order_date = $affwp_odfa->order_details->get( $referral, 'order_date' ); $order_total = $affwp_odfa->order_details->get( $referral, 'order_total' ); $referral_amount = $affwp_odfa->order_details->get( $referral, 'referral_amount' ); $customer_name = $affwp_odfa->order_details->get( $referral, 'customer_name' ); $customer_email = $affwp_odfa->order_details->get( $referral, 'customer_email' ); $customer_phone = $affwp_odfa->order_details->get( $referral, 'customer_phone' ); $customer_shipping_address = $affwp_odfa->order_details->get( $referral, 'customer_shipping_address' ); $customer_billing_address = $affwp_odfa->order_details->get( $referral, 'customer_billing_address' ); ob_start(); ?>

,