WC_Email_Admin_Payment_Gateway_Enabled::triggerpublicWC 10.6.0

Trigger the sending of this email.

Method of the class: WC_Email_Admin_Payment_Gateway_Enabled{}

Returns

null. Nothing (null).

Usage

$WC_Email_Admin_Payment_Gateway_Enabled = new WC_Email_Admin_Payment_Gateway_Enabled();
$WC_Email_Admin_Payment_Gateway_Enabled->trigger( $gateway );
$gateway(WC_Payment_Gateway) (required)
The gateway that was enabled.

Changelog

Since 10.6.0 Introduced.

WC_Email_Admin_Payment_Gateway_Enabled::trigger() code WC 10.8.1

public function trigger( $gateway ) {
	$this->setup_locale();

	if ( is_a( $gateway, 'WC_Payment_Gateway' ) ) {
		$this->object        = $gateway;
		$this->gateway_title = $gateway->get_method_title();

		$this->gateway_settings_url = esc_url_raw(
			self_admin_url( 'admin.php?page=wc-settings&tab=checkout&section=' . $gateway->id )
		);

		/**
		 * Filters the payment gateway settings URL for the admin payment gateway enabled email.
		 *
		 * @param string           $gateway_settings_url The payment gateway settings URL.
		 * @param WC_Payment_Gateway $gateway The payment gateway object.
		 * @return string The filtered payment gateway settings URL.
		 *
		 * @since 10.7.0
		 */
		$this->gateway_settings_url = apply_filters( 'woocommerce_payment_gateway_enabled_notification_settings_url', $this->gateway_settings_url, $gateway );

		$this->admin_email = get_option( 'admin_email' );
		$user              = get_user_by( 'email', $this->admin_email );
		$this->username    = $user ? $user->user_login : $this->admin_email;

		$this->placeholders['{gateway_title}'] = $this->gateway_title;
		$this->placeholders['{site_title}']    = $this->get_blogname();
	}

	if ( $this->is_enabled() && $this->get_recipient() ) {
		$this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
	}

	$this->restore_locale();
}