| @@ -214,8 +214,23 @@ | ||
| 214 | 214 | |
| 215 | 215 | update_option( FORGE12_OPTIN_SLUG . '_version', '5.8.0' ); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | + if ( version_compare( $currentVersion, '5.12.0' ) < 0 ) { | |
| 219 | + $logger->info( 'Updating to version 5.12.0 (adds form_ref column)', [ | |
| 220 | + 'plugin' => 'double-opt-in', | |
| 221 | + 'current' => $currentVersion, | |
| 222 | + 'target' => '5.12.0', | |
| 223 | + ] ); | |
| 224 | + | |
| 225 | + // form_ref tells two forms on the same page apart. Existing rows | |
| 226 | + // keep an empty value and stay tied to the whole form; nothing is | |
| 227 | + // guessed or back-filled. | |
| 228 | + createTableOptin(); | |
| 229 | + | |
| 230 | + update_option( FORGE12_OPTIN_SLUG . '_version', '5.12.0' ); | |
| 231 | + } | |
| 232 | + | |
| 218 | 233 | // Safety net: Ensure both tables always exist regardless of stored version. |
| 219 | 234 | // Handles edge cases such as database migrations, manual file uploads, or |
| 220 | 235 | // restored backups that are missing the custom tables. |
| 221 | 236 | global $wpdb; |