WC_Email_Admin_Payment_Gateway_Enabled::get_recipient
Get valid recipients.
Merges addresses from the wc_payment_gateway_enabled_notification_email_addresses for backward compatibility.
Method of the class: WC_Email_Admin_Payment_Gateway_Enabled{}
Hooks from the method
Returns
String.
Usage
$WC_Email_Admin_Payment_Gateway_Enabled = new WC_Email_Admin_Payment_Gateway_Enabled(); $WC_Email_Admin_Payment_Gateway_Enabled->get_recipient();
Changelog
| Since 10.6.0 | Introduced. |
WC_Email_Admin_Payment_Gateway_Enabled::get_recipient() WC Email Admin Payment Gateway Enabled::get recipient code WC 10.7.0
public function get_recipient() {
$recipient = parent::get_recipient();
if ( $this->object instanceof WC_Payment_Gateway ) {
/**
* Allows adding to the addresses that receive payment gateway enabled notifications.
*
* @param array $email_addresses The array of email addresses to notify.
* @param WC_Payment_Gateway $gateway The gateway that was enabled.
* @return array The augmented array of email addresses to notify.
*
* @since 8.5.0
*/
$extra_addresses = apply_filters( 'wc_payment_gateway_enabled_notification_email_addresses', array(), $this->object );
if ( ! empty( $extra_addresses ) && is_array( $extra_addresses ) ) {
$extra_valid = array_filter(
$extra_addresses,
function ( $email_address ): bool {
return (bool) filter_var( $email_address, FILTER_VALIDATE_EMAIL );
}
);
if ( ! empty( $extra_valid ) ) {
$existing = array_map( 'trim', explode( ',', $recipient ) );
$merged = array_unique( array_merge( $existing, $extra_valid ) );
$recipient = implode( ', ', array_filter( $merged ) );
}
}
}
return $recipient;
}