| @@ -355,10 +355,10 @@ | ||
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | // The "Detach to new tab" button tags its URL with this flag so the |
| 358 | 358 | // user can view one admin page classically without disabling desktop |
| 359 | - // mode account-wide. Only affects the single request — subsequent | |
| 360 | - // navigations inside the tab lose the flag and follow normal rules. | |
| 359 | + // mode account-wide. Navigations inside that tab keep it (see the | |
| 360 | + // Referer check below). | |
| 361 | 361 | if ( ! empty( $_GET[ OPENSTATION_CLASSIC_FLAG ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 362 | 362 | return; |
| 363 | 363 | } |
| 364 | 364 | |
| @@ -396,8 +396,15 @@ | ||
| 396 | 396 | */ |
| 397 | 397 | $redirect = apply_filters( 'openstation_admin_redirect_to_portal', true, get_current_user_id() ); |
| 398 | 398 | if ( ! $redirect ) { |
| 399 | 399 | return; |
| 400 | + } | |
| 401 | + | |
| 402 | + // A navigation out of a classic tab that lost the flag stays classic, | |
| 403 | + // with the flag back in the URL for the next navigation's Referer. | |
| 404 | + if ( '' !== $target && openstation_is_classic_referer() ) { | |
| 405 | + wp_safe_redirect( add_query_arg( OPENSTATION_CLASSIC_FLAG, '1', $target ) ); | |
| 406 | + exit; | |
| 400 | 407 | } |
| 401 | 408 | |
| 402 | 409 | // Route 1: straight to the shell screen. |
| 403 | 410 | if ( openstation_portal_forward_is_redundant( $target ) ) { |