Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions inc/checkout/class-checkout-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ public function maybe_redirect_to_admin_panel(): void {
'elementor-preview', // Elementor
'brizy-edit', // Brizy
'brizy-edit-iframe', // Brizy
'cs_preview_state', // Cornerstone
],
$custom_login_page,
$post,
Expand Down
24 changes: 24 additions & 0 deletions tests/WP_Ultimo/Checkout/Checkout_Pages_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@

$called = false;

$callback = function ($url, $key, $user_login, $user_data) use (&$called) {

Check warning on line 1182 in tests/WP_Ultimo/Checkout/Checkout_Pages_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

The method parameter $user_data is never used

Check warning on line 1182 in tests/WP_Ultimo/Checkout/Checkout_Pages_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

The method parameter $user_login is never used

Check warning on line 1182 in tests/WP_Ultimo/Checkout/Checkout_Pages_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

The method parameter $key is never used
$called = true;
// Integration overrides the destination but keeps host.
return add_query_arg('via', 'integration', $url);
Expand Down Expand Up @@ -1995,6 +1995,30 @@
$this->assertTrue(true);
}

/**
* Test maybe_redirect_to_admin_panel allows Cornerstone preview requests.
*/
public function test_maybe_redirect_to_admin_panel_allows_cornerstone_preview(): void {

$user_id = self::factory()->user->create(['role' => 'subscriber']);
wp_set_current_user($user_id);

$login_page_id = self::factory()->post->create(['post_type' => 'page']);
wu_save_setting('default_login_page', $login_page_id);

global $post;
$post = get_post($login_page_id);

$_REQUEST['cs_preview_state'] = 'preview-state';

$this->pages->maybe_redirect_to_admin_panel();

unset($_REQUEST['cs_preview_state']);
wp_set_current_user(0);

$this->assertTrue(true);
}

/**
* Test maybe_redirect_to_admin_panel exclusion list filter is applied.
*/
Expand All @@ -2010,7 +2034,7 @@
$post = get_post($login_page_id);

// Add a custom exclusion param via filter.
add_filter('wu_maybe_redirect_to_admin_panel_exclusion_list', function ($list) {

Check warning on line 2037 in tests/WP_Ultimo/Checkout/Checkout_Pages_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

It is recommended not to use reserved keyword "list" as function parameter name. Found: $list
$list[] = 'my_custom_builder';
return $list;
});
Expand Down
Loading