# double-opt-in/5.5.0/src/Events/Lifecycle/OptInCreatedEvent.php

Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification, version 5.5.0. 92 lines.

- Page: https://pluginprobe.com/plugins/double-opt-in/5.5.0/code/src/Events/Lifecycle/OptInCreatedEvent.php
- Raw: https://pluginprobe.com/plugins/double-opt-in/5.5.0/raw/src/Events/Lifecycle/OptInCreatedEvent.php
- Modified: 2026-07-13T09:16:42+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/double-opt-in/5.5.0/code/src/Events/Lifecycle/OptInCreatedEvent.php#L10-L20`.

```php
<?php
/**
 * OptIn Created Event
 *
 * @package Forge12\DoubleOptIn\Events\Lifecycle
 * @since   4.0.0
 */

namespace Forge12\DoubleOptIn\Events\Lifecycle;

use Forge12\DoubleOptIn\EventSystem\Event;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Class OptInCreatedEvent
 *
 * @api
 *
 * Dispatched when a new opt-in record is created after form submission.
 * Covered by the Addon API semver policy as of Core API 4.3.0.
 */
class OptInCreatedEvent extends Event {

	private int $optInId;
	private int $formId;
	private string $formType;
	private string $email;
	private string $hash;
	private array $formData;

	/**
	 * Constructor.
	 *
	 * @param int    $optInId  The opt-in record ID.
	 * @param int    $formId   The form ID.
	 * @param string $formType The form type (cf7, avada, etc.).
	 * @param string $email    The subscriber email.
	 * @param string $hash     The opt-in hash.
	 * @param array  $formData The submitted form data.
	 */
	public function __construct(
		int $optInId,
		int $formId,
		string $formType,
		string $email,
		string $hash,
		array $formData = array()
	) {
		parent::__construct();
		$this->optInId  = $optInId;
		$this->formId   = $formId;
		$this->formType = $formType;
		$this->email    = $email;
		$this->hash     = $hash;
		$this->formData = $formData;
	}

	/**
	 * {@inheritdoc}
	 */
	public static function getWordPressHookName(): string {
		return 'f12_cf7_doubleoptin_created';
	}

	public function getOptInId(): int {
		return $this->optInId;
	}

	public function getFormId(): int {
		return $this->formId;
	}

	public function getFormType(): string {
		return $this->formType;
	}

	public function getEmail(): string {
		return $this->email;
	}

	public function getHash(): string {
		return $this->hash;
	}

	public function getFormData(): array {
		return $this->formData;
	}
}

```
