| @@ -215,8 +215,10 @@ | ||
| 215 | 215 | |
| 216 | 216 | /** |
| 217 | 217 | * Redirect once to Launch, only once (at least once) when |
| 218 | 218 | * the email matches the entry in WP Admin > Settings > General. |
| 219 | + * Requests carrying a build-id keep redirecting until onboarding | |
| 220 | + * completes. | |
| 219 | 221 | * |
| 220 | 222 | * @return void |
| 221 | 223 | */ |
| 222 | 224 | public function redirectOnce() |
| @@ -228,12 +230,21 @@ | ||
| 228 | 230 | if (defined('EXTENDIFY_IS_THEME_EXTENDABLE') && !EXTENDIFY_IS_THEME_EXTENDABLE) { |
| 229 | 231 | return; |
| 230 | 232 | } |
| 231 | 233 | |
| 232 | - if (\get_option('extendify_launch_loaded', false) || !Config::$showLaunch) { | |
| 234 | + // Partner preview links must work on every admin visit, not just the first. | |
| 235 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 236 | + $buildIdRedirect = !empty(sanitize_text_field(wp_unslash($_GET['build-id'] ?? ''))) | |
| 237 | + && !Config::$launchCompleted; | |
| 238 | + | |
| 239 | + if (!$buildIdRedirect && \get_option('extendify_launch_loaded', false)) { | |
| 233 | 240 | return; |
| 234 | 241 | } |
| 235 | 242 | |
| 243 | + if (!Config::$showLaunch) { | |
| 244 | + return; | |
| 245 | + } | |
| 246 | + | |
| 236 | 247 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 237 | 248 | if (isset($_GET['page']) && $_GET['page'] === 'extendify-auto-launch') { |
| 238 | 249 | return; |
| 239 | 250 | } |
| @@ -251,8 +262,18 @@ | ||
| 251 | 262 | \wp_safe_redirect(\add_query_arg($query_params, \admin_url('admin.php'))); |
| 252 | 263 | exit; |
| 253 | 264 | } |
| 254 | 265 | return; |
| 266 | + } | |
| 267 | + | |
| 268 | + if ($buildIdRedirect) { | |
| 269 | + \update_option('permalink_structure', '/%postname%/'); | |
| 270 | + \update_option('extendify_needs_rewrite_flush', true); | |
| 271 | + | |
| 272 | + // Only AutoLaunch consumes build-id. | |
| 273 | + $query_params = $this->presentLaunchParams(['page' => 'extendify-auto-launch']); | |
| 274 | + \wp_safe_redirect(\add_query_arg($query_params, \admin_url('admin.php'))); | |
| 275 | + exit; | |
| 255 | 276 | } |
| 256 | 277 | |
| 257 | 278 | $user = \wp_get_current_user(); |
| 258 | 279 | if ( |