Automattic\WooCommerce\Internal\StockNotifications\Emails

EmailActionController::validate_and_maybe_process_requestpublicWC 1.0

Checks request parameters and processes the notification based on the action key.

Method of the class: EmailActionController{}

No Hooks.

Returns

null. Nothing (null).

Usage

$EmailActionController = new EmailActionController();
$EmailActionController->validate_and_maybe_process_request( $notification_id, $email_link_action_key ): void;
$notification_id(int) (required)
The ID of the notification to process.
$email_link_action_key(string) (required)
The action key from the email link.

EmailActionController::validate_and_maybe_process_request() code WC 10.3.6

public function validate_and_maybe_process_request( int $notification_id, string $email_link_action_key ): void {
	if ( empty( $email_link_action_key ) || empty( $notification_id ) ) {
		return;
	}

	$notification = $this->get_notification_to_be_processed( $notification_id );

	if ( ! $notification ) {
		return;
	}

	$action_key = $notification->get_meta( 'email_link_action_key' );
	if ( strpos( $action_key, ':' ) !== false ) {
		$this->process_verification_action( $notification, $email_link_action_key );
	} else {
		$this->process_unsubscribe_action( $notification, $email_link_action_key );
	}
}