From e8559ff92142e8244d71a0dfe091e0be44b22483 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Thu, 21 May 2026 00:22:53 +0200 Subject: [PATCH 1/8] Add testing on WordPress 7.0, bump minimum supported version. --- .github/workflows/acceptance-tests.yml | 20 +++++++++++--------- .github/workflows/integration-tests.yml | 18 ++++++++++-------- phpcs.xml.dist | 2 +- readme.txt | 2 +- user-switching.php | 11 +++++------ 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index 4716fe27..4f4addf9 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -39,22 +39,24 @@ jobs: # https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/ matrix: wp: - # Three most recent versions of WordPress + # Three most recent versions of WordPress: + - '7.0' - '6.9' - '6.8' - - '6.7' php: - # Most recent version of PHP supported by all of the above, plus 7.4 + # Most recent version of PHP supported by all of the above: - '8.4' + # Oldest support PHP: - '7.4' include: - # Latest WordPress on latest PHP - # - wp: '6.9' - # php: '8.5' - # Oldest supported WordPress on its newest supported PHP, plus 7.4: - - wp: '6.1' + # Latest WordPress on latest PHP: + - wp: '7.0' + php: '8.5' + # Oldest supported WordPress on its newest supported PHP: + - wp: '6.2' php: '8.2' - - wp: '6.1' + # Oldest supported WordPress on oldest support PHP: + - wp: '6.2' php: '7.4' fail-fast: false uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-acceptance-tests.yml@cc47e37177c694e00b901a5dc89fda5644bc550f # 2.9.1 diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index fa17a5bb..10e35ad4 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -40,22 +40,24 @@ jobs: # https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/ matrix: wp: - # Three most recent versions of WordPress + # Three most recent versions of WordPress: + - '7.0' - '6.9' - '6.8' - - '6.7' php: - # Most recent version of PHP supported by all of the above, plus 7.4 + # Most recent version of PHP supported by all of the above: - '8.4' + # Oldest support PHP: - '7.4' include: - # Latest WordPress on latest PHP - - wp: '6.9' + # Latest WordPress on latest PHP: + - wp: '7.0' php: '8.5' - # Oldest supported WordPress on its newest supported PHP, plus 7.4: - - wp: '6.1' + # Oldest supported WordPress on its newest supported PHP: + - wp: '6.2' php: '8.2' - - wp: '6.1' + # Oldest supported WordPress on oldest support PHP: + - wp: '6.2' php: '7.4' fail-fast: false with: diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 4659509a..9903923f 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -2,7 +2,7 @@ - + /.wordpress-org/* diff --git a/readme.txt b/readme.txt index 5d5df275..86daebe9 100644 --- a/readme.txt +++ b/readme.txt @@ -1,7 +1,7 @@ # User Switching Stable tag: 1.11.2 -Tested up to: 6.9 +Tested up to: 7.0 License: GPL v2 or later Tags: users, user switching, fast user switching, multisite, woocommerce Contributors: johnbillion diff --git a/user-switching.php b/user-switching.php index 225822f5..2d09c501 100644 --- a/user-switching.php +++ b/user-switching.php @@ -17,7 +17,7 @@ * Text Domain: user-switching * Domain Path: /languages/ * Network: true - * Requires at least: 6.1 + * Requires at least: 6.2 * Requires PHP: 7.4 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html * @@ -487,9 +487,8 @@ public function action_admin_notices(): void { $old_user = self::get_old_user(); if ( $old_user instanceof WP_User ) { - $locale = get_user_locale( $old_user ); - $switched_locale = switch_to_locale( $locale ); - $lang_attr = str_replace( '_', '-', $locale ); + $switched_locale = switch_to_user_locale( $old_user->ID ); + $lang_attr = str_replace( '_', '-', get_user_locale( $old_user ) ); ?>
@@ -678,7 +677,7 @@ public function action_admin_bar_menu( WP_Admin_Bar $wp_admin_bar ): void { * Adds a 'Switch back to {user}' link to access denied messages within the admin area. */ public function action_shutdown_for_wp_die(): void { - if ( ! did_action( 'admin_page_access_denied' ) && ! ( function_exists( 'did_filter' ) && did_filter( 'wp_die_handler' ) ) ) { + if ( ! did_action( 'admin_page_access_denied' ) && ! did_filter( 'wp_die_handler' ) ) { return; } @@ -1062,7 +1061,7 @@ public static function switched_to_message( WP_User $user ): string { * @return string The message. */ public static function switch_back_message( WP_User $user ): string { - $switched_locale = switch_to_locale( get_user_locale( $user ) ); + $switched_locale = switch_to_user_locale( $user->ID ); $message = sprintf( /* Translators: 1: user display name; 2: username; */ From b249f948228ec5801682517b02b316451a0e2e95 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 22 May 2026 18:05:39 +0200 Subject: [PATCH 2/8] Better matrix. --- .github/workflows/acceptance-tests.yml | 27 +++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index 4f4addf9..c52a4c4c 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -38,24 +38,25 @@ jobs: # See the following for PHP compatibility of WordPress versions: # https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/ matrix: - wp: - # Three most recent versions of WordPress: - - '7.0' - - '6.9' - - '6.8' - php: - # Most recent version of PHP supported by all of the above: - - '8.4' - # Oldest support PHP: - - '7.4' include: - # Latest WordPress on latest PHP: + # Latest: - wp: '7.0' php: '8.5' - # Oldest supported WordPress on its newest supported PHP: + - wp: '7.0' + php: '7.4' + # Latest -1: + - wp: '6.9' + php: '8.5' + - wp: '6.9' + php: '7.4' + # Latest -2: + - wp: '6.8' + php: '8.4' + - wp: '6.8' + php: '7.4' + # Oldest supported: - wp: '6.2' php: '8.2' - # Oldest supported WordPress on oldest support PHP: - wp: '6.2' php: '7.4' fail-fast: false From 4a258d99eb1e0c393e5930b5e7c8208fbb26236e Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 22 May 2026 18:06:02 +0200 Subject: [PATCH 3/8] Update the stubs. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 36357e28..43f0a796 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "require-dev": { "johnbillion/plugin-infrastructure": "2.9.1", "johnbillion/wp-compat": "1.3.0", - "php-stubs/wordpress-stubs": "6.9.0", + "php-stubs/wordpress-stubs": "7.0.0", "phpcompatibility/phpcompatibility-wp": "2.1.8", "phpstan/phpstan": "2.1.33", "phpstan/phpstan-phpunit": "2.0.11", From 4e30bdce426d590ab67dfb37004ecc196371c428 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 22 May 2026 18:08:52 +0200 Subject: [PATCH 4/8] Silence some complaints about the plugin-infrastructure import. --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 74735938..4a155ca4 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "engines": { "node": ">=24" }, + "type": "module", "devDependencies": { "@johnbillion/plugin-infrastructure": "2.9.1", "@jsdevtools/version-bump-prompt": "^6.1.0", From 08c95788d4b4187343689c293ba39a80d6cc5a54 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 22 May 2026 18:14:33 +0200 Subject: [PATCH 5/8] o_O --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 43f0a796..3478c3a9 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "require-dev": { "johnbillion/plugin-infrastructure": "2.9.1", "johnbillion/wp-compat": "1.3.0", - "php-stubs/wordpress-stubs": "7.0.0", + "php-stubs/wordpress-stubs": "7.0.0 as 6.9.4", "phpcompatibility/phpcompatibility-wp": "2.1.8", "phpstan/phpstan": "2.1.33", "phpstan/phpstan-phpunit": "2.0.11", From 04be9823736a3bd0fea83d4953f921e821f0cd66 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 22 May 2026 18:48:40 +0200 Subject: [PATCH 6/8] Update wp-compat. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3478c3a9..78d55cd9 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ }, "require-dev": { "johnbillion/plugin-infrastructure": "2.9.1", - "johnbillion/wp-compat": "1.3.0", + "johnbillion/wp-compat": "1.5.0", "php-stubs/wordpress-stubs": "7.0.0 as 6.9.4", "phpcompatibility/phpcompatibility-wp": "2.1.8", "phpstan/phpstan": "2.1.33", From 9d04dad03ce3e32609a5492ee5a13a9eace34f20 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 22 May 2026 20:01:00 +0200 Subject: [PATCH 7/8] Update plugin-infrastructure. --- .github/workflows/acceptance-tests.yml | 2 +- .github/workflows/coding-standards.yml | 2 +- .github/workflows/deploy-assets.yml | 2 +- .github/workflows/deploy-tag.yml | 2 +- .github/workflows/integration-tests.yml | 2 +- .github/workflows/lint-workflows.yml | 2 +- .github/workflows/nightly-tests.yml | 4 ++-- .github/workflows/static-analysis.yml | 2 +- .github/workflows/verify-distribution.yml | 2 +- composer.json | 2 +- package-lock.json | 8 ++++---- package.json | 2 +- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index c52a4c4c..9b63c8a6 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -60,7 +60,7 @@ jobs: - wp: '6.2' php: '7.4' fail-fast: false - uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-acceptance-tests.yml@cc47e37177c694e00b901a5dc89fda5644bc550f # 2.9.1 + uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-acceptance-tests.yml@667f50aeb549afa5a5cf0137a21a08de1bc983f5 # 2.9.3 with: wp: ${{ matrix.wp }} php: ${{ matrix.php }} diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 10dd1c87..9dbc72d8 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -32,7 +32,7 @@ jobs: name: ${{ matrix.label }} permissions: contents: read # Needed to clone the repo. - uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-coding-standards.yml@cc47e37177c694e00b901a5dc89fda5644bc550f # 2.9.1 + uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-coding-standards.yml@667f50aeb549afa5a5cf0137a21a08de1bc983f5 # 2.9.3 strategy: matrix: label: diff --git a/.github/workflows/deploy-assets.yml b/.github/workflows/deploy-assets.yml index e6e3031c..0c8aa690 100644 --- a/.github/workflows/deploy-assets.yml +++ b/.github/workflows/deploy-assets.yml @@ -13,7 +13,7 @@ jobs: name: WordPress.org permissions: contents: read # Needed to clone the repo. - uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-deploy-assets.yml@cc47e37177c694e00b901a5dc89fda5644bc550f # 2.9.1 + uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-deploy-assets.yml@667f50aeb549afa5a5cf0137a21a08de1bc983f5 # 2.9.3 with: plugin: user-switching readme: readme.txt diff --git a/.github/workflows/deploy-tag.yml b/.github/workflows/deploy-tag.yml index 7f65b42d..f4471234 100644 --- a/.github/workflows/deploy-tag.yml +++ b/.github/workflows/deploy-tag.yml @@ -19,7 +19,7 @@ jobs: deploy: name: Deploy Tag if: github.event_name == 'workflow_dispatch' || github.event.release.prerelease == false - uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-deploy-tag.yml@cc47e37177c694e00b901a5dc89fda5644bc550f # 2.9.1 + uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-deploy-tag.yml@667f50aeb549afa5a5cf0137a21a08de1bc983f5 # 2.9.3 permissions: contents: write # Required to push the new branch issues: write # Required for write access to milestones. diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 10e35ad4..a38d0e6b 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -34,7 +34,7 @@ jobs: name: WP ${{ matrix.wp }} permissions: contents: read # Needed to clone the repo. - uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-integration-tests.yml@cc47e37177c694e00b901a5dc89fda5644bc550f # 2.9.1 + uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-integration-tests.yml@667f50aeb549afa5a5cf0137a21a08de1bc983f5 # 2.9.3 strategy: # See the following for PHP compatibility of WordPress versions: # https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/ diff --git a/.github/workflows/lint-workflows.yml b/.github/workflows/lint-workflows.yml index 7d65d18d..0c24ee70 100644 --- a/.github/workflows/lint-workflows.yml +++ b/.github/workflows/lint-workflows.yml @@ -27,4 +27,4 @@ jobs: security-events: write # Required for upload-sarif to upload SARIF files. contents: read # Needed to clone the repo. actions: read # Needed for upload-sarif to read workflow run info. - uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-workflow-lint.yml@cc47e37177c694e00b901a5dc89fda5644bc550f # 2.9.1 + uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-workflow-lint.yml@667f50aeb549afa5a5cf0137a21a08de1bc983f5 # 2.9.3 diff --git a/.github/workflows/nightly-tests.yml b/.github/workflows/nightly-tests.yml index 8357a6d3..6821bcb4 100644 --- a/.github/workflows/nightly-tests.yml +++ b/.github/workflows/nightly-tests.yml @@ -41,7 +41,7 @@ jobs: - '8.3' - '7.4' fail-fast: false - uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-acceptance-tests.yml@cc47e37177c694e00b901a5dc89fda5644bc550f # 2.9.1 + uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-acceptance-tests.yml@667f50aeb549afa5a5cf0137a21a08de1bc983f5 # 2.9.3 with: wp: 'nightly' php: ${{ matrix.php }} @@ -52,7 +52,7 @@ jobs: name: Nightly ${{ matrix.label }} permissions: contents: read # Needed to clone the repo. - uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-integration-tests.yml@cc47e37177c694e00b901a5dc89fda5644bc550f # 2.9.1 + uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-integration-tests.yml@667f50aeb549afa5a5cf0137a21a08de1bc983f5 # 2.9.3 strategy: matrix: label: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index f08f9d1c..7b2e0ee2 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -28,7 +28,7 @@ jobs: name: ${{ matrix.label }} permissions: contents: read # Needed to clone the repo. - uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-static-analysis.yml@cc47e37177c694e00b901a5dc89fda5644bc550f # 2.9.1 + uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-static-analysis.yml@667f50aeb549afa5a5cf0137a21a08de1bc983f5 # 2.9.3 strategy: matrix: label: diff --git a/.github/workflows/verify-distribution.yml b/.github/workflows/verify-distribution.yml index 43984755..dcb2e3dd 100644 --- a/.github/workflows/verify-distribution.yml +++ b/.github/workflows/verify-distribution.yml @@ -34,7 +34,7 @@ jobs: permissions: contents: write # Needed to push commits pull-requests: write # Needed to create a PR - uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-verify-distribution.yml@cc47e37177c694e00b901a5dc89fda5644bc550f # 2.9.1 + uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-verify-distribution.yml@667f50aeb549afa5a5cf0137a21a08de1bc983f5 # 2.9.3 with: plugin: user-switching owner: johnbillion diff --git a/composer.json b/composer.json index 78d55cd9..c0db4d5e 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "composer/installers": "^1.0 || ^2.0" }, "require-dev": { - "johnbillion/plugin-infrastructure": "2.9.1", + "johnbillion/plugin-infrastructure": "2.9.3", "johnbillion/wp-compat": "1.5.0", "php-stubs/wordpress-stubs": "7.0.0 as 6.9.4", "phpcompatibility/phpcompatibility-wp": "2.1.8", diff --git a/package-lock.json b/package-lock.json index 7394f4e4..723a39a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.11.2", "license": "GPL-2.0-or-later", "devDependencies": { - "@johnbillion/plugin-infrastructure": "2.9.1", + "@johnbillion/plugin-infrastructure": "2.9.3", "@jsdevtools/version-bump-prompt": "^6.1.0", "@playwright/test": "^1.55.0", "@types/node": "^24.3.0", @@ -459,9 +459,9 @@ } }, "node_modules/@johnbillion/plugin-infrastructure": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@johnbillion/plugin-infrastructure/-/plugin-infrastructure-2.9.1.tgz", - "integrity": "sha512-7ZfUv+BM5/0KzzH/GUgCg9Qyb2UYJP5Uv8dfqMcpRVqxx5YJI5sVa6BSnN3yoFpe/lgGXZ5WPN409Z9ZcKfZcA==", + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/@johnbillion/plugin-infrastructure/-/plugin-infrastructure-2.9.3.tgz", + "integrity": "sha512-pXI/+Gk0Slw/F4H0Qk++RXZ4dNapUrZYop4vJbN2PzUEkKlNpaCWdL2tywANxQNYVjgSnZ+9z2mIGSfbQchpgg==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 4a155ca4..7bac9985 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ }, "type": "module", "devDependencies": { - "@johnbillion/plugin-infrastructure": "2.9.1", + "@johnbillion/plugin-infrastructure": "2.9.3", "@jsdevtools/version-bump-prompt": "^6.1.0", "@playwright/test": "^1.55.0", "@types/node": "^24.3.0", From 5423eef2474d62208409a57627e8197f81945a66 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 22 May 2026 20:14:09 +0200 Subject: [PATCH 8/8] Progress. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c0db4d5e..adc90e37 100644 --- a/composer.json +++ b/composer.json @@ -79,7 +79,7 @@ "phpcs -ps --colors --report-code --report-summary --report-width=80 --basepath='./' ." ], "test:phpstan": [ - "phpstan analyze -v --memory-limit=1024M" + "phpstan analyze -v --memory-limit=2G" ], "test:start": [ "tests-start"