# double-opt-in/3.0.3/OnUpdate.php

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

- Page: https://pluginprobe.com/plugins/double-opt-in/3.0.3/code/OnUpdate.php
- Raw: https://pluginprobe.com/plugins/double-opt-in/3.0.3/raw/OnUpdate.php
- Modified: 2024-09-05T13:56:02+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/3.0.3/code/OnUpdate.php#L10-L20`.

```php
<?php

namespace forge12\contactform7\CF7DoubleOptIn;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

function onUpdate() {
	// Only run if the version installed not exist or the version is < 1.7
	// this will add categories to already existing plugins
	if ( version_compare( get_site_option( FORGE12_OPTIN_SLUG . '_version' ), '1.7' ) < 0 ) {
		createTableOptinCategories();
		createTableOptin();

		update_option( FORGE12_OPTIN_SLUG . '_version', '1.7' );
	}

	// Only run if the version installed not exist or the version is < 2.0
	// this will add categories to already existing plugins
	if ( version_compare( get_site_option( FORGE12_OPTIN_SLUG . '_version' ), '2.0' ) < 0 ) {
		createTableOptin();

		update_option( FORGE12_OPTIN_SLUG . '_version', '2.0' );
	}

	if ( version_compare( get_site_option( FORGE12_OPTIN_SLUG . '_version' ), '3.0.1' ) < 0 ) {
		createTableOptin();

		update_option( FORGE12_OPTIN_SLUG . '_version', '3.0.1' );
	}
}

onUpdate();
```
