Automattic\WooCommerce\Internal\Admin\Notes

EmailNotification::trigger()publicWC 1.0

Trigger the sending of this email.

Метод класса: EmailNotification{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$EmailNotification = new EmailNotification();
$EmailNotification->trigger( $user_email, $user_id, $user_name );
$user_email(строка) (обязательный)
Email to send the note.
$user_id(int) (обязательный)
User id to to track the note.
$user_name(строка) (обязательный)
User's name.

Код EmailNotification::trigger() WC 8.7.0

public function trigger( $user_email, $user_id, $user_name ) {
	$this->recipient               = $user_email;
	$this->opened_tracking_url     = sprintf(
		'%1$s/wp-json/wc-analytics/admin/notes/tracker/%2$d/user/%3$d',
		site_url(),
		$this->note->get_id(),
		$user_id
	);
	$this->trigger_note_action_url = sprintf(
		'%1$s&external_redirect=1&note=%2$d&user=%3$d&action=',
		wc_admin_url(),
		$this->note->get_id(),
		$user_id
	);

	if ( $user_name ) {
		/* translators: %s = merchant name */
		$this->placeholders['{greetings}'] = sprintf( __( 'Hi %s,', 'woocommerce' ), $user_name );
	}

	$this->send(
		$this->get_recipient(),
		$this->get_subject(),
		$this->get_content(),
		$this->get_headers(),
		$this->get_attachments()
	);
	Notes::record_tracks_event_with_user( $user_id, 'email_note_sent', array( 'note_name' => $this->note->get_name() ) );
}