From 54a2adb5731812be77cfcb78fd2b41df26edf9dc Mon Sep 17 00:00:00 2001 From: Marius Jensen Date: Tue, 9 Jun 2026 09:37:30 +0200 Subject: [PATCH 1/5] Environments: Add support forums environment. This introduces the support forums as an environment in the WordPress.org suite of sites. Complete with full dependency setup, including: - Multisite setup - Plugin and theme directory subsites (scaffolds for plugin and theme support forums, not for their development) - Full set of every usertype available - Default forum creation, mimicking the current WordPress.org forums There is a caveat that Gutenberg is _currently_ pinned to version 17.9, due to the Blocks Everywhere plugin, and that Blocks Everywhere is not rendering properly pending an update in https://github.com/Automattic/blocks-everywhere/pull/211 --- environments/README.md | 38 +++++ environments/package.json | 3 +- environments/support-forums/.wp-env.json | 47 ++++++ environments/support-forums/bin/.htaccess | 15 ++ .../support-forums/bin/after-start.sh | 140 ++++++++++++++++++ 5 files changed, 242 insertions(+), 1 deletion(-) create mode 100644 environments/support-forums/.wp-env.json create mode 100644 environments/support-forums/bin/.htaccess create mode 100644 environments/support-forums/bin/after-start.sh diff --git a/environments/README.md b/environments/README.md index 020dd05e94..63e97faa5b 100644 --- a/environments/README.md +++ b/environments/README.md @@ -118,6 +118,44 @@ npm run translate:env -- run cli -- wp **Local overrides:** create `translate/.wp-env.override.json` (git-ignored) to override config values like `WP_HOME` / `WP_SITEURL` for testing behind a custom hostname. +### Support Forums + +A local instance of the WordPress.org Support Forums with bbPress, the support theme, and supporting plugins. + +**Start:** + +```bash +npm run support:env start +``` + +First start automatically sets up a multisite network, creates sub-sites for Plugins (`/plugins`) and Themes (`/themes`), and provisions the default user accounts. + +**Note that these plugin and theme directories are only used for forum references, not for development of the respective environments.** + +**Access:** `http://localhost:8888` + +**WP CLI:** + +```bash +npm run support:env -- run cli -- wp +``` + +**User accounts:** + +All accounts use the password `password`. + +| Username | Forum role | Notes | +|---|---|---| +| `admin` | Network administrator | Full network admin access | +| `keymaster` | `bbp_keymaster` | Top-level forum admin; can manage all forum content | +| `moderator` | `bbp_moderator` | Can moderate topics and replies | +| `pluginauthor` | `bbp_participant` | Subscriber on the Plugins sub-site | +| `plugincontributor` | `bbp_participant` | Subscriber on the Plugins sub-site | +| `pluginsupport` | `bbp_participant` | Plugin support rep; subscriber on the Plugins sub-site | +| `themeauthor` | `bbp_participant` | Subscriber on the Themes sub-site | +| `themesupport` | `bbp_participant` | Theme support rep; subscriber on the Themes sub-site (unused) | +| `visitor` | `bbp_participant` | Regular site visitor | + ### Handbook (in-plugin) The Handbook plugin has its own `.wp-env.json` in `wordpress.org/public_html/wp-content/plugins/handbook/`. diff --git a/environments/package.json b/environments/package.json index 8deccf4440..701a46e3ab 100644 --- a/environments/package.json +++ b/environments/package.json @@ -15,7 +15,8 @@ "browsehappy:env": "wp-env --config browsehappy/.wp-env.json", "translate:env": "wp-env --config translate/.wp-env.json", "translate:import": "npm run translate:env -- run cli -- wp eval-file wp-content/env-bin/import-from-wporg.php", - "translate:refresh": "npm run translate:env -- run cli -- wp option delete wporg_translate_env_seeded" + "translate:refresh": "npm run translate:env -- run cli -- wp option delete wporg_translate_env_seeded", + "support:env": "wp-env --config support-forums/.wp-env.json" }, "devDependencies": { "@wordpress/env": "^11" diff --git a/environments/support-forums/.wp-env.json b/environments/support-forums/.wp-env.json new file mode 100644 index 0000000000..b4e1797d41 --- /dev/null +++ b/environments/support-forums/.wp-env.json @@ -0,0 +1,47 @@ +{ + "core": "WordPress/WordPress#master", + "phpVersion": "8.4", + "testsEnvironment": false, + "plugins": [ + "https://downloads.wordpress.org/plugin/bbpress.zip", + "https://downloads.wordpress.org/plugin/gutenberg.17.9.0.zip", + "https://downloads.wordpress.org/plugin/blocks-everywhere.zip", + "../wordpress.org/public_html/wp-content/plugins/wporg-bbp-user-moderation", + "../wordpress.org/public_html/wp-content/plugins/wporg-bbp-user-mention-autocomplete", + "../wordpress.org/public_html/wp-content/plugins/wporg-bbp-user-badges", + "../wordpress.org/public_html/wp-content/plugins/wporg-bbp-topic-resolution", + "../wordpress.org/public_html/wp-content/plugins/wporg-bbp-topic-archive", + "../wordpress.org/public_html/wp-content/plugins/wporg-bbp-term-subscription", + "../wordpress.org/public_html/wp-content/plugins/wporg-bbp-redirect", + "../wordpress.org/public_html/wp-content/plugins/wporg-bbp-codexify", + "../wordpress.org/public_html/wp-content/plugins/wporg-bbp-code-blocks-expand-contract", + "../wordpress.org/public_html/wp-content/plugins/support-forums" + ], + "themes": [ + "../wordpress.org/public_html/wp-content/themes/pub/wporg-support-2024", + "WordPress/wporg-parent-2021#build" + ], + "mappings": { + ".htaccess": "./support-forums/bin/.htaccess", + "wp-content/wporg/style": "../wordpress.org/public_html/style", + "wp-content/mu-plugins": "./mocks/mu-plugins", + "wp-content/mu-plugins/pub": "../wordpress.org/public_html/wp-content/mu-plugins/pub", + "wp-content/mu-plugins/wporg-mu-plugins": "WordPress/wporg-mu-plugins#build", + "wp-content/plugins/plugin-directory": "../wordpress.org/public_html/wp-content/plugins/plugin-directory", + "wp-content/plugins/theme-directory": "../wordpress.org/public_html/wp-content/plugins/theme-directory", + "wp-content/plugins/wporg-two-factor": "../wordpress.org/public_html/wp-content/plugins/wporg-two-factor" + }, + "lifecycleScripts": { + "afterStart": "bash support-forums/bin/after-start.sh" + }, + "config": { + "WP_DEBUG": true, + "JETPACK_DEV_DEBUG": true, + "WPORGPATH": "/var/www/html/wp-content/wporg", + "WP_ENVIRONMENT_TYPE": "local", + "WPORG_SUPPORT_FORUMS_BLOGID": 1, + "WPORG_PLUGIN_DIRECTORY_BLOGID": 2, + "WPORG_THEME_DIRECTORY_BLOGID": 3, + "PLUGINS_TABLE_PREFIX": "wp_2_" + } +} diff --git a/environments/support-forums/bin/.htaccess b/environments/support-forums/bin/.htaccess new file mode 100644 index 0000000000..2130d24f62 --- /dev/null +++ b/environments/support-forums/bin/.htaccess @@ -0,0 +1,15 @@ +# BEGIN WordPress +# The directives (lines) between "BEGIN WordPress" and "END WordPress" are +# dynamically generated, and should only be modified via WordPress filters. +# Any changes to the directives between these markers will be overwritten. + +RewriteEngine On +RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] +RewriteBase / +RewriteRule ^index\.php$ - [L] +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule . /index.php [L] + + +# END WordPress diff --git a/environments/support-forums/bin/after-start.sh b/environments/support-forums/bin/after-start.sh new file mode 100644 index 0000000000..566a3f667e --- /dev/null +++ b/environments/support-forums/bin/after-start.sh @@ -0,0 +1,140 @@ +#!/bin/bash +# +# Runs after wp-env start. Sets up permalinks, creates pages, and imports plugins. +# + +SETUP_VALIDATION_FILE="/var/www/html/.wp-env-setup-complete" + +CONFIG="--config support-forums/.wp-env.json" +WP="npx wp-env $CONFIG run cli --" + +# Check if the setup has already been completed. +if $WP bash -c "[ -f '$SETUP_VALIDATION_FILE' ]"; then + echo "Setup already completed. Skipping first-run environment configuration." + exit 0 +fi + +### +# Create multisite framework +### +echo "Setting up multisite framework..." +$WP wp core multisite-convert + +# Network enable the themes +$WP wp theme enable wporg-support-2024 + +# Create the plugins site. +echo "Creating sub-sites..." +$WP wp site create --slug=plugins --title=Plugins + +# Create the site. +$WP wp site create --slug=themes --title=Themes + +# WordPress, per now, does not properly identify port numbers in multisite URLs when creating +# sites. Because of this, when we set it up using `wp-env`, followed by a `wp core multisite-convert` +# from the WP-CLI package, strange things happen. +# This search-replace is in place to undo the weirdness, and make the environment workable. +echo "Fixing multisite URLs..." +$WP wp search-replace 'localhost:8888/:8888' 'localhost:8888' --skip-plugins --skip-themes --all-tables +$WP wp search-replace 'localhost8888' 'localhost:8888' --skip-plugins --skip-themes --all-tables + +### +# Create the various users we will need +### +echo "Creating users..." + +# Add a forum keymaster account (User ID 2). +$WP wp user create keymaster keymaster@example.com --role=subscriber --user_pass=password + +# Add a forum moderator account (User ID 3). +$WP wp user create moderator moderator@example.com --role=subscriber --user_pass=password + +# Add a plugin author (User ID 4). +$WP wp user create pluginauthor plugin-author@example.com --role=subscriber --user_pass=password + +# Add a plugin contributor (User ID 5). +$WP wp user create plugincontributor plugin-contributor@example.com --role=subscriber --user_pass=password + +# Add a plugin support representative (User ID 6). +$WP wp user create pluginsupport plugin-support@example.com --role=subscriber --user_pass=password + +# Add a theme author (User ID 7). +$WP wp user create themeauthor theme-author@example.com --role=subscriber --user_pass=password + +# Add a site support representative (user ID 8) - Currently unused, but added in anticipation. +$WP wp user create themesupport theme-support@example.com --role=subscriber --user_pass=password + +# Add a forum visitor +$WP wp user create visitor visitor@example.com --role=subscriber --user_pass=password + +### +# Set up the `plugins` sub-site with associated content. +### + +echo "Setting up minimum required plugins sub-site..." + +# Add site-specific plugins. +$WP wp plugin install jetpack --activate --url=localhost:8888/plugins +$WP wp plugin activate plugin-directory --url=localhost:8888/plugins + +# Add the plugin-related roles to this subsite. +$WP wp user set-role pluginauthor subscriber --url=localhost:8888/plugins +$WP wp user set-role plugincontributor subscriber --url=localhost:8888/plugins +$WP wp user set-role pluginsupport subscriber --url=localhost:8888/plugins + +# Add `Hello Dolly` as a plugin. +$WP wp post create --post_type=plugin --post_status=publish --post_author=4 --post_title='Hello Dolly' --post_date='2022-08-20 01:00:00' --post_modified='2022-08-20 01:00:00' --post_modified_gmt='2022-08-20 01:00:00' --url=localhost:8888/plugins + +### +# Set up the `themes` sub-site with associated content. +### + +echo "Setting up minimum required themes sub-site..." + +# Set up the site identity. +$WP wp option update blogname 'WordPress.org Forums' + +# Add site-specific plugins. +$WP wp plugin activate theme-directory --url=localhost:8888/themes + +# Add the theme-related roles to this subsite. +$WP wp user set-role themeauthor subscriber --url=localhost:8888/themes +$WP wp user set-role themesupport subscriber --url=localhost:8888/themes + +### +# Set up the primary network site, the forums, with associated content. +### + +echo "Setting up forums site..." + +# Add all roles to the forums. +$WP wp user set-role keymaster bbp_keymaster +$WP wp user set-role moderator bbp_moderator +$WP wp user set-role pluginauthor bbp_participant +$WP wp user set-role plugincontributor bbp_participant +$WP wp user set-role pluginsupport bbp_participant +$WP wp user set-role themeauthor bbp_participant +$WP wp user set-role themesupport bbp_participant +$WP wp user set-role visitor bbp_participant + +# Add the initial set of forums. +$WP wp post create --post_type=forum --post_status=publish --post_title='Installing WordPress' --post_content='If you encounter any problems while setting up WordPress.' --post_date='2022-08-20 01:00:00' --post_modified='2022-08-20 01:00:00' --post_modified_gmt='2022-08-20 01:00:00' +$WP wp post create --post_type=forum --post_status=publish --post_title='Fixing WordPress' --post_content='For any problems encountered after setting up WordPress.' --post_date='2022-08-20 01:00:00' --post_modified='2022-08-20 01:00:00' --post_modified_gmt='2022-08-20 01:00:00' +$WP wp post create --post_type=forum --post_status=publish --post_title='Plugins' --post_content='Forum for plugin-specific support topics (hidden on WordPress.org).' --post_date='2022-08-20 01:00:00' --post_modified='2022-08-20 01:00:00' --post_modified_gmt='2022-08-20 01:00:00' +$WP wp post create --post_type=forum --post_status=publish --post_title='Themes' --post_content='Forum for theme-specific support topics (hidden on WordPress.org).' --post_date='2022-08-20 01:00:00' --post_modified='2022-08-20 01:00:00' --post_modified_gmt='2022-08-20 01:00:00' +$WP wp post create --post_type=forum --post_status=publish --post_title='Reviews' --post_content='Forum for plugin and theme reviews (hidden on WordPress.org).' --post_date='2022-08-20 01:00:00' --post_modified='2022-08-20 01:00:00' --post_modified_gmt='2022-08-20 01:00:00' + +# Activate the forum theme. +$WP wp theme activate wporg-support-2024 + +echo "Setting up network-wide plugins..." + +# Activate network-wide plugins +$WP wp plugin activate wporg-two-factor --network + +# Setup, and flush rewrite rules. +echo "Setting up permalinks..." +$WP wp rewrite structure '/%postname%/' +$WP wp rewrite flush + +$WP bash -c "touch '$SETUP_VALIDATION_FILE'" From 5d19ba11aae599ae08424151cf6ae86179e3aea9 Mon Sep 17 00:00:00 2001 From: "Marius L. Jensen" <468735+Clorith@users.noreply.github.com> Date: Mon, 13 Jul 2026 22:41:18 +0200 Subject: [PATCH 2/5] Enable strict error handling in after-start.sh so its easier to debug --- environments/support-forums/bin/after-start.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/environments/support-forums/bin/after-start.sh b/environments/support-forums/bin/after-start.sh index 566a3f667e..869857fa6e 100644 --- a/environments/support-forums/bin/after-start.sh +++ b/environments/support-forums/bin/after-start.sh @@ -3,6 +3,8 @@ # Runs after wp-env start. Sets up permalinks, creates pages, and imports plugins. # +set -euo pipefail + SETUP_VALIDATION_FILE="/var/www/html/.wp-env-setup-complete" CONFIG="--config support-forums/.wp-env.json" From 86b7f56fcd918994cc4f36bb73411baef8b06dab Mon Sep 17 00:00:00 2001 From: Marius Jensen Date: Thu, 23 Jul 2026 12:31:04 +0200 Subject: [PATCH 3/5] Restructure the `after-start.sh` file to cover the need for a rosetta forum site as well, and order the content correctly --- .../support-forums/bin/after-start.sh | 105 ++++++++++++++---- 1 file changed, 84 insertions(+), 21 deletions(-) diff --git a/environments/support-forums/bin/after-start.sh b/environments/support-forums/bin/after-start.sh index 869857fa6e..2fefc6e0cb 100644 --- a/environments/support-forums/bin/after-start.sh +++ b/environments/support-forums/bin/after-start.sh @@ -5,13 +5,30 @@ set -euo pipefail -SETUP_VALIDATION_FILE="/var/www/html/.wp-env-setup-complete" +SETUP_VALIDATION_FILE="/var/www/.wp-env-setup-complete" CONFIG="--config support-forums/.wp-env.json" WP="npx wp-env $CONFIG run cli --" +WPSUDO="npx wp-env $CONFIG run wordpress -- sudo" + +MINIMUM_SUPPORT_PLUGINS=( + "bbpress" + "gutenberg" + "blocks-everywhere" + "wporg-bbp-user-moderation" + "wporg-bbp-user-mention-autocomplete" + "wporg-bbp-user-badges" + "wporg-bbp-topic-resolution" + "wporg-bbp-topic-archive" + "wporg-bbp-term-subscription" + "wporg-bbp-redirect" + "wporg-bbp-codexify" + "wporg-bbp-code-blocks-expand-contract" + "support-forums" +) # Check if the setup has already been completed. -if $WP bash -c "[ -f '$SETUP_VALIDATION_FILE' ]"; then +if $WPSUDO bash -c "[ -f '$SETUP_VALIDATION_FILE' ]"; then echo "Setup already completed. Skipping first-run environment configuration." exit 0 fi @@ -23,14 +40,20 @@ echo "Setting up multisite framework..." $WP wp core multisite-convert # Network enable the themes -$WP wp theme enable wporg-support-2024 +$WP wp theme enable wporg-support-2024 --network -# Create the plugins site. +# Set up the main site identity. +$WP wp option update blogname 'WordPress.org Global Forums' + +# Create the Plugins sub-site. echo "Creating sub-sites..." -$WP wp site create --slug=plugins --title=Plugins +$WP wp site create --slug=plugins --title="Plugins dependency - WordPress.org Forums" + +# Create the Themes sub-site. +$WP wp site create --slug=themes --title="Themes dependency - WordPress.org Forums" -# Create the site. -$WP wp site create --slug=themes --title=Themes +# Create rosetta support sub-site. +$WP wp site create --slug=rosetta --title="Rosetta Forums - WordPress.org Forums" # WordPress, per now, does not properly identify port numbers in multisite URLs when creating # sites. Because of this, when we set it up using `wp-env`, followed by a `wp core multisite-convert` @@ -48,22 +71,28 @@ echo "Creating users..." # Add a forum keymaster account (User ID 2). $WP wp user create keymaster keymaster@example.com --role=subscriber --user_pass=password -# Add a forum moderator account (User ID 3). +# Add a rosetta forum keymaster account (User ID 3). +$WP wp user create rosettakeymaster rosetta-keymaster@example.com --role=subscriber --user_pass=password + +# Add a forum moderator account (User ID 4). $WP wp user create moderator moderator@example.com --role=subscriber --user_pass=password -# Add a plugin author (User ID 4). +# Add a rosetta forum moderator account (User ID 5). +$WP wp user create rosettamoderator rosetta-moderator@example.com --role=subscriber --user_pass=password + +# Add a plugin author (User ID 6). $WP wp user create pluginauthor plugin-author@example.com --role=subscriber --user_pass=password -# Add a plugin contributor (User ID 5). +# Add a plugin contributor (User ID 7). $WP wp user create plugincontributor plugin-contributor@example.com --role=subscriber --user_pass=password -# Add a plugin support representative (User ID 6). +# Add a plugin support representative (User ID 8). $WP wp user create pluginsupport plugin-support@example.com --role=subscriber --user_pass=password -# Add a theme author (User ID 7). +# Add a theme author (User ID 9). $WP wp user create themeauthor theme-author@example.com --role=subscriber --user_pass=password -# Add a site support representative (user ID 8) - Currently unused, but added in anticipation. +# Add a site support representative (user ID 10) - Currently unused, but added in anticipation. $WP wp user create themesupport theme-support@example.com --role=subscriber --user_pass=password # Add a forum visitor @@ -71,6 +100,7 @@ $WP wp user create visitor visitor@example.com --role=subscriber --user_pass=pas ### # Set up the `plugins` sub-site with associated content. +# The plugins sub-site is a dependency for the Global support forums, and must be prepared first. ### echo "Setting up minimum required plugins sub-site..." @@ -89,13 +119,11 @@ $WP wp post create --post_type=plugin --post_status=publish --post_author=4 --po ### # Set up the `themes` sub-site with associated content. +# The themes sub-site is a dependency for the Global support forums, and must be prepared first. ### echo "Setting up minimum required themes sub-site..." -# Set up the site identity. -$WP wp option update blogname 'WordPress.org Forums' - # Add site-specific plugins. $WP wp plugin activate theme-directory --url=localhost:8888/themes @@ -109,9 +137,15 @@ $WP wp user set-role themesupport subscriber --url=localhost:8888/themes echo "Setting up forums site..." +# Activate the forum plugins and theme. +$WP wp plugin activate "${MINIMUM_SUPPORT_PLUGINS[@]}" +$WP wp theme activate wporg-support-2024 + # Add all roles to the forums. $WP wp user set-role keymaster bbp_keymaster $WP wp user set-role moderator bbp_moderator +$WP wp user set-role rosettakeymaster bbp_participant +$WP wp user set-role rosettamoderator bbp_participant $WP wp user set-role pluginauthor bbp_participant $WP wp user set-role plugincontributor bbp_participant $WP wp user set-role pluginsupport bbp_participant @@ -126,17 +160,46 @@ $WP wp post create --post_type=forum --post_status=publish --post_title='Plugins $WP wp post create --post_type=forum --post_status=publish --post_title='Themes' --post_content='Forum for theme-specific support topics (hidden on WordPress.org).' --post_date='2022-08-20 01:00:00' --post_modified='2022-08-20 01:00:00' --post_modified_gmt='2022-08-20 01:00:00' $WP wp post create --post_type=forum --post_status=publish --post_title='Reviews' --post_content='Forum for plugin and theme reviews (hidden on WordPress.org).' --post_date='2022-08-20 01:00:00' --post_modified='2022-08-20 01:00:00' --post_modified_gmt='2022-08-20 01:00:00' -# Activate the forum theme. -$WP wp theme activate wporg-support-2024 +### +# Set up the secondary rosetta forums site, with associated content. +### + +echo "Setting up rosetta forums site..." + +# Activate the forum plugins and theme. +$WP wp plugin activate "${MINIMUM_SUPPORT_PLUGINS[@]}" --url=localhost:8888/rosetta +$WP wp theme activate wporg-support-2024 --url=localhost:8888/rosetta + +# Add relevant roles to the rosetta forums. +$WP wp user set-role rosettakeymaster bbp_keymaster --url=localhost:8888/rosetta +$WP wp user set-role rosettamoderator bbp_moderator --url=localhost:8888/rosetta +$WP wp user set-role keymaster bbp_participant --url=localhost:8888/rosetta +$WP wp user set-role moderator bbp_participant --url=localhost:8888/rosetta +$WP wp user set-role pluginauthor bbp_participant --url=localhost:8888/rosetta +$WP wp user set-role plugincontributor bbp_participant --url=localhost:8888/rosetta +$WP wp user set-role pluginsupport bbp_participant --url=localhost:8888/rosetta +$WP wp user set-role themeauthor bbp_participant --url=localhost:8888/rosetta +$WP wp user set-role themesupport bbp_participant --url=localhost:8888/rosetta +$WP wp user set-role visitor bbp_participant --url=localhost:8888/rosetta + +# Add the initial set of forums. +$WP wp post create --post_type=forum --post_status=publish --post_title='Installing WordPress' --post_content='If you encounter any problems while setting up WordPress.' --post_date='2022-08-20 01:00:00' --post_modified='2022-08-20 01:00:00' --post_modified_gmt='2022-08-20 01:00:00' --url=localhost:8888/rosetta +$WP wp post create --post_type=forum --post_status=publish --post_title='Fixing WordPress' --post_content='For any problems encountered after setting up WordPress.' --post_date='2022-08-20 01:00:00' --post_modified='2022-08-20 01:00:00' --post_modified_gmt='2022-08-20 01:00:00' --url=localhost:8888/rosetta + +### +# Set up network-wide plugins +### echo "Setting up network-wide plugins..." # Activate network-wide plugins -$WP wp plugin activate wporg-two-factor --network +#$WP wp plugin activate wporg-two-factor --network # Setup, and flush rewrite rules. -echo "Setting up permalinks..." +echo "Setting up permalinks on forum sites..." $WP wp rewrite structure '/%postname%/' $WP wp rewrite flush +$WP wp rewrite structure '/%postname%/' --url=localhost:8888/rosetta +$WP wp rewrite flush --url=localhost:8888/rosetta -$WP bash -c "touch '$SETUP_VALIDATION_FILE'" +$WPSUDO bash -c "touch '$SETUP_VALIDATION_FILE'" From d15c029c89560576fb8b87be6c5340736d663f90 Mon Sep 17 00:00:00 2001 From: Marius Jensen Date: Thu, 23 Jul 2026 12:31:20 +0200 Subject: [PATCH 4/5] Add a multisite `.htaccess` file to the mix --- environments/support-forums/bin/.htaccess | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/environments/support-forums/bin/.htaccess b/environments/support-forums/bin/.htaccess index 2130d24f62..fd61675cdf 100644 --- a/environments/support-forums/bin/.htaccess +++ b/environments/support-forums/bin/.htaccess @@ -1,15 +1,19 @@ -# BEGIN WordPress -# The directives (lines) between "BEGIN WordPress" and "END WordPress" are -# dynamically generated, and should only be modified via WordPress filters. -# Any changes to the directives between these markers will be overwritten. - +# BEGIN WordPress Multisite +# Using subfolder network type: https://developer.wordpress.org/advanced-administration/server/web-server/httpd/ + RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$ - [L] -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule . /index.php [L] - -# END WordPress +# add a trailing slash to /wp-admin +RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] + +RewriteCond %{REQUEST_FILENAME} -f [OR] +RewriteCond %{REQUEST_FILENAME} -d +RewriteRule ^ - [L] +RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] +RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] +RewriteRule . index.php [L] + +# END WordPress Multisite From e458bc6a4eb326e08ab88494bf5e1f10587e131e Mon Sep 17 00:00:00 2001 From: Marius Jensen Date: Thu, 23 Jul 2026 12:31:54 +0200 Subject: [PATCH 5/5] Remove the no longer existent `wporg-two-factor` dependency and extend the mock stub functions used by the Support theme --- .../mocks/mu-plugins/wporg-two-factor-fns-stub.php | 11 +++++++++++ environments/support-forums/.wp-env.json | 3 +-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/environments/mocks/mu-plugins/wporg-two-factor-fns-stub.php b/environments/mocks/mu-plugins/wporg-two-factor-fns-stub.php index 1d1fcf5ead..93cc95e76a 100644 --- a/environments/mocks/mu-plugins/wporg-two-factor-fns-stub.php +++ b/environments/mocks/mu-plugins/wporg-two-factor-fns-stub.php @@ -21,3 +21,14 @@ function get_onboarding_account_url() { return home_url( '/' ); } } + +if ( ! function_exists( __NAMESPACE__ . '\get_edit_account_url' ) ) { + /** + * URL for editing account details via the new two-factor interface. Points at the local home. + * + * @return string + */ + function get_edit_account_url( $username = null ) { + return home_url( '/' ); + } +} diff --git a/environments/support-forums/.wp-env.json b/environments/support-forums/.wp-env.json index b4e1797d41..5c4d6055e6 100644 --- a/environments/support-forums/.wp-env.json +++ b/environments/support-forums/.wp-env.json @@ -28,8 +28,7 @@ "wp-content/mu-plugins/pub": "../wordpress.org/public_html/wp-content/mu-plugins/pub", "wp-content/mu-plugins/wporg-mu-plugins": "WordPress/wporg-mu-plugins#build", "wp-content/plugins/plugin-directory": "../wordpress.org/public_html/wp-content/plugins/plugin-directory", - "wp-content/plugins/theme-directory": "../wordpress.org/public_html/wp-content/plugins/theme-directory", - "wp-content/plugins/wporg-two-factor": "../wordpress.org/public_html/wp-content/plugins/wporg-two-factor" + "wp-content/plugins/theme-directory": "../wordpress.org/public_html/wp-content/plugins/theme-directory" }, "lifecycleScripts": { "afterStart": "bash support-forums/bin/after-start.sh"