id = 'ppl_afw_affiliate_rejected'; $this->title = __( 'Affiliate rejected', 'affireo-affiliates-for-woocommerce' ); $this->description = __( 'Sent to an applicant when their affiliate application is declined.', 'affireo-affiliates-for-woocommerce' ); $this->customer_email = true; $this->heading = __( 'Update on your affiliate application', 'affireo-affiliates-for-woocommerce' ); $this->subject = __( 'Update on your affiliate application', 'affireo-affiliates-for-woocommerce' ); add_action( 'ppl_afw_affiliate_rejected', array( $this, 'trigger' ), 20, 2 ); parent::__construct(); } /** * Triggers the email. * * @since 1.0.0 * @param int $affiliate_id Affiliate id. * @param string $note Reason. */ public function trigger( $affiliate_id, $note = '' ) { $this->setup_locale(); $this->note = (string) $note; $this->affiliate = $this->affiliates()->find( $affiliate_id ); $user = $this->affiliate ? get_userdata( (int) $this->affiliate->user_id ) : null; if ( $user ) { $this->recipient = $user->user_email; $this->dispatch(); } $this->restore_locale(); } /** * Body content. * * @since 1.0.0 * @return string */ protected function get_body() { $body = '

' . esc_html__( 'Thank you for your interest. Unfortunately your affiliate application was not approved at this time.', 'affireo-affiliates-for-woocommerce' ) . '

'; if ( '' !== $this->note ) { $body .= '

' . esc_html( $this->note ) . '

'; } return $body; } }