| @@ -171,9 +171,10 @@ | ||
| 171 | 171 | protected function redirect_with_notice( string $notice_code ): void { |
| 172 | 172 | $url = add_query_arg( |
| 173 | 173 | array( |
| 174 | 174 | 'page' => 'learn-press-settings', |
| 175 | - 'tab' => 'mcp', | |
| 175 | + 'tab' => 'advanced', | |
| 176 | + 'section' => 'mcp', | |
| 176 | 177 | 'lp_mcp_notice' => $notice_code, |
| 177 | 178 | ), |
| 178 | 179 | admin_url( 'admin.php' ) |
| 179 | 180 | ); |
| @@ -213,13 +214,19 @@ | ||
| 213 | 214 | * |
| 214 | 215 | * @return bool |
| 215 | 216 | */ |
| 216 | 217 | protected function is_mcp_keys_settings_screen(): bool { |
| 217 | - $page = LP_Request::get_param( 'page', '', 'key' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 218 | - $tab = LP_Request::get_param( 'tab', '', 'key' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 219 | 218 | |
| 220 | - return 'learn-press-settings' === $page | |
| 221 | - && 'mcp' === $tab; | |
| 219 | + $page = sanitize_key( $_REQUEST['page'] ?? '' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 220 | + $tab = sanitize_key( $_REQUEST['tab'] ?? '' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 221 | + $section = sanitize_key( $_REQUEST['section'] ?? '' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 222 | + | |
| 223 | + if ( 'learn-press-settings' !== $page ) { | |
| 224 | + return false; | |
| 225 | + } | |
| 226 | + | |
| 227 | + return ( 'advanced' === $tab && 'mcp' === $section ) | |
| 228 | + || 'mcp' === $tab; | |
| 222 | 229 | } |
| 223 | 230 | |
| 224 | 231 | /** |
| 225 | 232 | * Check whether MCP integration is enabled. |