Skip to content

fix: expose sovereign tenant extension hooks#1278

Merged
superdav42 merged 1 commit into
mainfrom
fix/core-sovereign-filters
May 26, 2026
Merged

fix: expose sovereign tenant extension hooks#1278
superdav42 merged 1 commit into
mainfrom
fix/core-sovereign-filters

Conversation

@superdav42
Copy link
Copy Markdown
Collaborator

@superdav42 superdav42 commented May 26, 2026

Summary

  • Replace core sovereign-tenant implementation with extension hooks for UI output, checkout/cart guards, gateway handling, compat loading, and checkout URL filtering.
  • Remove core sovereign helper/template files so sovereign behavior is owned by the multi-tenancy addon.
  • Update tests to assert skip-filter behavior instead of built-in sovereign behavior.

Verification

  • rg -n "sovereign|get_main_site_checkout_url|wu_is_sovereign_tenant|wu_mt_main_site_account_url|WU_MT_SOVEREIGN_TENANT|sovereign-redirect|functions/sovereign|sovereign\.php" inc tests views returned no matches.
  • vendor/bin/phpcs on changed production files and UI test passed.
  • vendor/bin/phpunit --filter 'Sovereign_Mode_Elements_Test|test_(create_order|maybe_handle_order_submission|check_user_exists|handle_inline_login)_returns_early_when_skip_filter_is_enabled|test_cart_constructor_sets_error_when_skip_filter_responds' passed: 6 tests, 22 assertions.
  • Pre-commit hook passed PHPCS and PHPStan for staged production PHP files.

Companion

  • Requires addon companion PR in ultimate-multisite-multi-tenancy to implement the sovereign callbacks for these hooks.

Summary by CodeRabbit

  • Refactor

    • Restructured checkout and account page handlers to support external filter-based control over behavior
    • Removed automatic context-specific redirects from checkout, account summary, billing info, membership, and other dashboard elements
    • Updated compatibility modules to use filter-based skip conditions
  • Tests

    • Updated test suite to verify filter-based control mechanisms

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

📝 Walkthrough

Walkthrough

This PR systematically replaces hardcoded sovereign-tenant conditional guards throughout the checkout, UI, and compatibility layers with externally-controllable filter hooks, removing the centralized wu_is_sovereign_tenant() helper and enabling pluggable behavior control instead.

Changes

Sovereign-tenant guard refactoring

Layer / File(s) Summary
Remove sovereign helper functions and update bootstrap
inc/functions/sovereign.php, inc/class-wp-ultimo.php
Deletes wu_is_sovereign_tenant() and wu_mt_main_site_account_url() helpers, and updates load_public_apis() to stop loading sovereign.php while ensuring session.php and documentation.php are loaded.
Refactor cart and checkout AJAX handlers with filter guards
inc/checkout/class-cart.php, inc/checkout/class-checkout.php
Cart::__construct() and four checkout AJAX entry points replace sovereign-tenant early-exit blocks with new filter-based guards: wu_cart_skip_initialization, wu_checkout_skip_order_submission, wu_checkout_skip_create_order, wu_checkout_skip_user_exists_check, and wu_checkout_skip_inline_login.
Update checkout URL filtering and remove helper methods
inc/checkout/class-checkout-pages.php
Checkout_Pages::init() registers post_type_link and page_link hooks for centralized URL rewriting, filter_checkout_urls() delegates to wu_checkout_pages_checkout_url filter, removes public helpers get_main_site_checkout_url() and redirect_checkout_urls_in_sovereign_context(), and removes redundant parameter unsets in email handlers.
Refactor UI element output with filter-based skip guards
inc/ui/class-account-summary-element.php, inc/ui/class-billing-info-element.php, inc/ui/class-checkout-element.php, inc/ui/class-current-membership-element.php, inc/ui/class-current-site-element.php, inc/ui/class-domain-mapping-element.php, inc/ui/class-invoices-element.php, inc/ui/class-my-sites-element.php, inc/ui/class-template-switching-element.php
Nine UI element classes replace hardcoded sovereign-tenant conditional redirect output with early-return guards driven by new wu_*_skip_output filters (wu_account_skip_output, wu_billing_info_skip_output, wu_checkout_skip_output, etc.), allowing external code to suppress element rendering.
Refactor compatibility and gateway managers with filter guards
inc/managers/class-gateway-manager.php, inc/compat/class-auto-delete-users-compat.php, inc/compat/class-edit-users-compat.php, inc/compat/class-multiple-accounts-compat.php
Gateway_Manager payment confirmation and polling handlers replace wu_is_sovereign_tenant() guards with wu_gateway_skip_confirmations and wu_gateway_skip_payment_status_poll filters; three compatibility classes replace sovereign-tenant init guards with corresponding wu_*_skip_compat filters.
Update admin page documentation for return_to_url property
inc/admin-pages/customer-panel/class-account-admin-page.php, inc/admin-pages/customer-panel/class-add-new-site-admin-page.php, inc/admin-pages/customer-panel/class-checkout-admin-page.php, inc/admin-pages/customer-panel/class-my-sites-admin-page.php, inc/admin-pages/customer-panel/class-template-switching-admin-page.php
Five admin page classes clarify $return_to_url property docblocks to describe "external redirects" instead of "sovereign-tenant context"; one class adds PHPCS ignore for template-action sanitization.
Refactor test coverage for filter-based early returns
tests/WP_Ultimo/Checkout/Checkout_Test.php, tests/WP_Ultimo/UI/Sovereign_Mode_Elements_Test.php
Checkout_Test refactors tearDown() and test suite to manage checkout skip filters instead of sovereign guards, adds skip_checkout() and set_cart_error() helpers, and replaces sovereign-context assertions with filter-enabled early-exit verification. Sovereign_Mode_Elements_Test unifies filter-driven fixtures with shared skip_output callback and consolidated output-interception test.
Remove deprecated sovereign-redirect template
views/elements/sovereign-redirect.php
Deletes template that previously rendered sovereign-tenant redirect UI markup.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

review-feedback-scanned

Poem

🐰 The sovereign walls come tumbling down,
As filters bloom in every town,
No more fixed gates, but hooks for all—
Extensibility answers the call! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: expose sovereign tenant extension hooks' directly and accurately describes the core objective of the pull request: replacing the core sovereign-tenant implementation with extension hooks that can be controlled externally.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/core-sovereign-filters

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@github-actions
Copy link
Copy Markdown

Performance Test Results

Performance test results for bc6b737 are in 🛎️!

Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown.

URL: /

Run DB Queries Memory Before Template Template WP Total LCP TTFB LCP - TTFB
0 40 (-2 / -4% ) 37.76 MB 854.50 ms (-56.00 ms / -7% ) 160.00 ms (-4.50 ms / -3% ) 1071.50 ms 2044.00 ms 1959.05 ms 82.30 ms (+5.25 ms / +6% )
1 56 49.13 MB 961.00 ms 151.50 ms 1113.50 ms 2132.00 ms 2054.75 ms 74.85 ms

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
inc/ui/class-template-switching-element.php (1)

433-433: ⚡ Quick win

Document the new filter contract inline.

Since this is now a primary extension point, add a short hook docblock (@param/expected boolean return) immediately above wu_template_switching_skip_output to make integration safer and clearer for addon authors.

Proposed patch
+		/**
+		 * Filters whether the Template Switching element output should be skipped.
+		 *
+		 * `@param` bool                        $skip    Whether to skip rendering.
+		 * `@param` array                       $atts    Block/shortcode attributes.
+		 * `@param` string|null                 $content Block/shortcode inner content.
+		 * `@param` Template_Switching_Element  $this    Current element instance.
+		 */
 		if (apply_filters('wu_template_switching_skip_output', false, $atts, $content, $this)) {
 			return;
 		}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@inc/ui/class-template-switching-element.php` at line 433, Add an inline hook
docblock immediately above the apply_filters call for
'wu_template_switching_skip_output' documenting the filter contract: state that
the filter expects and returns a boolean skip flag, list the parameters ($skip
default false, $atts array, $content string|null, $this the current
instance/object), and include an `@return` bool line; place this short PHPDoc
block directly above the line containing
apply_filters('wu_template_switching_skip_output', ...) in
class-template-switching-element.php so addon authors can see the expected types
and return value.
tests/WP_Ultimo/UI/Sovereign_Mode_Elements_Test.php (1)

30-39: ⚡ Quick win

Add checkout element skip hook to this coverage map.

Line 30-39 sets up skip-output hooks for UI elements, but wu_checkout_skip_output is missing, leaving one migrated element guard untested.

♻️ Proposed patch
 		$this->elements = [
 			'wu_account_skip_output'            => Account_Summary_Element::get_instance(),
 			'wu_billing_info_skip_output'       => Billing_Info_Element::get_instance(),
+			'wu_checkout_skip_output'           => Checkout_Element::get_instance(),
 			'wu_invoices_skip_output'           => Invoices_Element::get_instance(),
 			'wu_my_sites_skip_output'           => My_Sites_Element::get_instance(),
 			'wu_current_membership_skip_output' => Current_Membership_Element::get_instance(),
 			'wu_current_site_skip_output'       => Current_Site_Element::get_instance(),
 			'wu_template_switching_skip_output' => Template_Switching_Element::get_instance(),
 			'wu_domain_mapping_skip_output'     => Domain_Mapping_Element::get_instance(),
 		];
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/WP_Ultimo/UI/Sovereign_Mode_Elements_Test.php` around lines 30 - 39,
Add the missing checkout skip-output hook to the elements coverage map by
inserting the key 'wu_checkout_skip_output' mapped to
Checkout_Element::get_instance() into the $this->elements array alongside the
other entries (e.g., Account_Summary_Element::get_instance(),
Billing_Info_Element::get_instance(), etc.) so the migrated checkout element
guard is included in the test coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@inc/checkout/class-cart.php`:
- Around line 354-356: The constructor early-return when
apply_filters('wu_cart_skip_initialization', ...) leaves $this->errors empty so
Cart::is_valid() still returns true; instead, when the filter returns true
populate $this->errors with a WP_Error (e.g. 'cart_skipped' code and a short
message) in the same block before returning so downstream callers like
Checkout::process_order() can detect the failure via is_wp_error()/is_valid
checks; modify the block around the apply_filters call in the Cart class
constructor (same scope as the existing apply_filters line) to set a WP_Error on
$this->errors and then return.

In `@inc/checkout/class-checkout-pages.php`:
- Around line 134-135: filter_checkout_urls() currently bails unless the second
argument is a \WP_Post, but the page_link hook passes an int ID; update
filter_checkout_urls() to accept either a \WP_Post or an int by detecting when
$post (or the second parameter name) is numeric and calling get_post($post) to
retrieve the WP_Post object before proceeding, then continue using
get_signup_pages() as before so the wu_checkout_pages_checkout_url filter runs
for normal page permalinks too.

---

Nitpick comments:
In `@inc/ui/class-template-switching-element.php`:
- Line 433: Add an inline hook docblock immediately above the apply_filters call
for 'wu_template_switching_skip_output' documenting the filter contract: state
that the filter expects and returns a boolean skip flag, list the parameters
($skip default false, $atts array, $content string|null, $this the current
instance/object), and include an `@return` bool line; place this short PHPDoc
block directly above the line containing
apply_filters('wu_template_switching_skip_output', ...) in
class-template-switching-element.php so addon authors can see the expected types
and return value.

In `@tests/WP_Ultimo/UI/Sovereign_Mode_Elements_Test.php`:
- Around line 30-39: Add the missing checkout skip-output hook to the elements
coverage map by inserting the key 'wu_checkout_skip_output' mapped to
Checkout_Element::get_instance() into the $this->elements array alongside the
other entries (e.g., Account_Summary_Element::get_instance(),
Billing_Info_Element::get_instance(), etc.) so the migrated checkout element
guard is included in the test coverage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bea9141b-3e77-41ca-9fe1-c1086090f31b

📥 Commits

Reviewing files that changed from the base of the PR and between 38b2dd5 and 0da4044.

📒 Files selected for processing (26)
  • inc/admin-pages/customer-panel/class-account-admin-page.php
  • inc/admin-pages/customer-panel/class-add-new-site-admin-page.php
  • inc/admin-pages/customer-panel/class-checkout-admin-page.php
  • inc/admin-pages/customer-panel/class-my-sites-admin-page.php
  • inc/admin-pages/customer-panel/class-template-switching-admin-page.php
  • inc/checkout/class-cart.php
  • inc/checkout/class-checkout-pages.php
  • inc/checkout/class-checkout.php
  • inc/class-wp-ultimo.php
  • inc/compat/class-auto-delete-users-compat.php
  • inc/compat/class-edit-users-compat.php
  • inc/compat/class-multiple-accounts-compat.php
  • inc/functions/sovereign.php
  • inc/managers/class-gateway-manager.php
  • inc/ui/class-account-summary-element.php
  • inc/ui/class-billing-info-element.php
  • inc/ui/class-checkout-element.php
  • inc/ui/class-current-membership-element.php
  • inc/ui/class-current-site-element.php
  • inc/ui/class-domain-mapping-element.php
  • inc/ui/class-invoices-element.php
  • inc/ui/class-my-sites-element.php
  • inc/ui/class-template-switching-element.php
  • tests/WP_Ultimo/Checkout/Checkout_Test.php
  • tests/WP_Ultimo/UI/Sovereign_Mode_Elements_Test.php
  • views/elements/sovereign-redirect.php
💤 Files with no reviewable changes (3)
  • views/elements/sovereign-redirect.php
  • inc/functions/sovereign.php
  • inc/class-wp-ultimo.php

Comment on lines +354 to +356
if (apply_filters('wu_cart_skip_initialization', false, $args, $this)) {
return;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Skipped carts still validate as usable.

If this filter returns true, the constructor exits with $this->errors empty and no cart state built. Cart::is_valid() will still return true, so Checkout::process_order() can keep going with a zero-item cart instead of stopping the flow.

💡 Suggested fix
-		if (apply_filters('wu_cart_skip_initialization', false, $args, $this)) {
+		$skip_initialization = apply_filters('wu_cart_skip_initialization', false, $args, $this);
+
+		if ($skip_initialization) {
+			if ($skip_initialization instanceof \WP_Error) {
+				$this->errors->merge_from($skip_initialization);
+			} elseif ( ! $this->errors->has_errors()) {
+				$this->errors->add('cart_initialization_skipped', __('This checkout is not available.', 'ultimate-multisite'));
+			}
+
 			return;
 		}

As per coding guidelines, "Use WP_Error for validation/operation failures instead of exceptions; check return values with is_wp_error()".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (apply_filters('wu_cart_skip_initialization', false, $args, $this)) {
return;
}
$skip_initialization = apply_filters('wu_cart_skip_initialization', false, $args, $this);
if ($skip_initialization) {
if ($skip_initialization instanceof \WP_Error) {
$this->errors->merge_from($skip_initialization);
} elseif ( ! $this->errors->has_errors()) {
$this->errors->add('cart_initialization_skipped', __('This checkout is not available.', 'ultimate-multisite'));
}
return;
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@inc/checkout/class-cart.php` around lines 354 - 356, The constructor
early-return when apply_filters('wu_cart_skip_initialization', ...) leaves
$this->errors empty so Cart::is_valid() still returns true; instead, when the
filter returns true populate $this->errors with a WP_Error (e.g. 'cart_skipped'
code and a short message) in the same block before returning so downstream
callers like Checkout::process_order() can detect the failure via
is_wp_error()/is_valid checks; modify the block around the apply_filters call in
the Cart class constructor (same scope as the existing apply_filters line) to
set a WP_Error on $this->errors and then return.

Comment on lines +134 to +135
add_filter('post_type_link', [$this, 'filter_checkout_urls'], 10, 2);
add_filter('page_link', [$this, 'filter_checkout_urls'], 10, 2);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

WordPress hook reference: what arguments do the page_linkandpost_type_linkfilters pass to callbacks, and doespage_linkpass a page ID or aWP_Post object as its second parameter?

💡 Result:

  1. page_link filter: arguments passed to callbacks WordPress applies the page permalink with apply_filters( 'page_link', $link, $post->ID, $sample). That means your callback receives 3 arguments: (1) $link (string) the page’s permalink, (2) $post_id (int) the ID of the page, and (3) $sample (bool) whether it’s a sample permalink. [1][2] 2) post_type_link filter: arguments passed to callbacks WordPress applies the custom post type permalink with apply_filters( 'post_type_link', $post_link, $post, $leavename, $sample). That means your callback receives 4 arguments: (1) $post_link (string) the post’s permalink, (2) $post (WP_Post) the post object, (3) $leavename (bool), and (4) $sample (bool). [3][4] Does page_link pass a page ID or a WP_Post object as its second parameter? It passes the page ID (an int) as the second parameter ($post_id), not a WP_Post object. This is explicit in both the hook reference for page_link and in get_page_link where the filter is invoked with $post->ID as the second argument. [1][2]

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="inc/checkout/class-checkout-pages.php"
if [ ! -f "$FILE" ]; then
  echo "Missing file: $FILE" >&2
  exit 1
fi

echo "==> $FILE (lines 110-190)"
nl -ba "$FILE" | sed -n '110,190p'

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 201


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE="inc/checkout/class-checkout-pages.php"

awk 'NR>=110 && NR<=190 {printf "%d\t%s\n", NR, $0}' "$FILE"

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 2541


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE="inc/checkout/class-checkout-pages.php"

rg -n "function\s+get_signup_pages\s*\(" "$FILE"

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 123


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE="inc/checkout/class-checkout-pages.php"
awk 'NR>=960 && NR<=1040 {printf "%d\t%s\n", NR, $0}' "$FILE"

Repository: Ultimate-Multisite/ultimate-multisite

Length of output: 2502


Fix filter_checkout_urls() to support page_link’s callback argument type

page_link passes the page ID (int) as the 2nd argument, but filter_checkout_urls() immediately returns unless the 2nd argument is a \WP_Post. Since get_signup_pages() returns page IDs for signup/login/update/etc., the wu_checkout_pages_checkout_url filter never runs on the normal page permalink path.

💡 Suggested fix
 	public function filter_checkout_urls($permalink, $post) {
+		if (is_numeric($post)) {
+			$post = get_post((int) $post);
+		}
 
 		if (! is_a($post, '\WP_Post')) {
 			return $permalink;
 		}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@inc/checkout/class-checkout-pages.php` around lines 134 - 135,
filter_checkout_urls() currently bails unless the second argument is a \WP_Post,
but the page_link hook passes an int ID; update filter_checkout_urls() to accept
either a \WP_Post or an int by detecting when $post (or the second parameter
name) is numeric and calling get_post($post) to retrieve the WP_Post object
before proceeding, then continue using get_signup_pages() as before so the
wu_checkout_pages_checkout_url filter runs for normal page permalinks too.

@superdav42 superdav42 merged commit 5064889 into main May 26, 2026
11 checks passed
@superdav42
Copy link
Copy Markdown
Collaborator Author

Summary

  • Replace core sovereign-tenant implementation with extension hooks for UI output, checkout/cart guards, gateway handling, compat loading, and checkout URL filtering.
  • Remove core sovereign helper/template files so sovereign behavior is owned by the multi-tenancy addon.
  • Update tests to assert skip-filter behavior instead of built-in sovereign behavior.

Verification

  • rg -n "sovereign|get_main_site_checkout_url|wu_is_sovereign_tenant|wu_mt_main_site_account_url|WU_MT_SOVEREIGN_TENANT|sovereign-redirect|functions/sovereign|sovereign\.php" inc tests views returned no matches.
  • vendor/bin/phpcs on changed production files and UI test passed.
  • vendor/bin/phpunit --filter 'Sovereign_Mode_Elements_Test|test_(create_order|maybe_handle_order_submission|check_user_exists|handle_inline_login)_returns_early_when_skip_filter_is_enabled|test_cart_constructor_sets_error_when_skip_filter_responds' passed: 6 tests, 22 assertions.
  • Pre-commit hook passed PHPCS and PHPStan for staged production PHP files.

Companion

  • Requires addon companion PR in ultimate-multisite-multi-tenancy to implement the sovereign callbacks for these hooks.


Merged via PR #1278 to main.
Merged by deterministic merge pass (pulse-wrapper.sh).


aidevops.sh v3.19.5 spent 13m on this as a headless bash routine.

@superdav42
Copy link
Copy Markdown
Collaborator Author

Summary

  • Replace core sovereign-tenant implementation with extension hooks for UI output, checkout/cart guards, gateway handling, compat loading, and checkout URL filtering.
  • Remove core sovereign helper/template files so sovereign behavior is owned by the multi-tenancy addon.
  • Update tests to assert skip-filter behavior instead of built-in sovereign behavior.

Verification

  • rg -n "sovereign|get_main_site_checkout_url|wu_is_sovereign_tenant|wu_mt_main_site_account_url|WU_MT_SOVEREIGN_TENANT|sovereign-redirect|functions/sovereign|sovereign\.php" inc tests views returned no matches.
  • vendor/bin/phpcs on changed production files and UI test passed.
  • vendor/bin/phpunit --filter 'Sovereign_Mode_Elements_Test|test_(create_order|maybe_handle_order_submission|check_user_exists|handle_inline_login)_returns_early_when_skip_filter_is_enabled|test_cart_constructor_sets_error_when_skip_filter_responds' passed: 6 tests, 22 assertions.
  • Pre-commit hook passed PHPCS and PHPStan for staged production PHP files.

Companion

  • Requires addon companion PR in ultimate-multisite-multi-tenancy to implement the sovereign callbacks for these hooks.


Merged via PR #1278 to main.
Merged by deterministic merge pass (pulse-wrapper.sh).


aidevops.sh v3.19.5 spent 32s on this as a headless bash routine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-feedback-scanned Merged PR already scanned for quality feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant