From e7f279a2fdea89c1ce85b6fbad415e5992144b01 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Mon, 5 Jan 2026 15:36:29 +0800 Subject: [PATCH 1/8] Member Content: Automatically add `grve-container` for Impeka Theme --- .github/workflows/tests.yml | 2 +- ...ass-convertkit-output-restrict-content.php | 13 +++-- includes/functions.php | 26 ++++++++++ .../integrations/class-convertkit-impeka.php | 50 ++++++++++++++++++ ...roductThirdPartyThemeOrPageBuilderCest.php | 52 +++++++++++++++++++ wp-convertkit.php | 3 ++ 6 files changed, 140 insertions(+), 6 deletions(-) create mode 100644 includes/integrations/class-convertkit-impeka.php diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ec742687a..d4d74d342 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,7 +32,7 @@ jobs: DB_HOST: localhost INSTALL_PLUGINS: "admin-menu-editor autoptimize beaver-builder-lite-version block-visibility contact-form-7 classic-editor custom-post-type-ui debloat elementor forminator jetpack-boost mailchimp-for-wp rocket-lazy-load woocommerce wordpress-seo wpforms-lite litespeed-cache wp-crontrol wp-super-cache w3-total-cache wp-fastest-cache wp-optimize sg-cachepress" # Don't include this repository's Plugin here. INSTALL_PLUGINS_URLS: "https://downloads.wordpress.org/plugin/convertkit-for-woocommerce.1.6.4.zip http://cktestplugins.wpengine.com/wp-content/uploads/2024/01/convertkit-action-filter-tests.zip http://cktestplugins.wpengine.com/wp-content/uploads/2024/11/disable-doing-it-wrong-notices.zip http://cktestplugins.wpengine.com/wp-content/uploads/2025/03/uncode-js_composer.7.8.zip http://cktestplugins.wpengine.com/wp-content/uploads/2025/03/uncode-core.zip" # URLs to specific third party Plugins - INSTALL_THEMES_URLS: "http://cktestplugins.wpengine.com/wp-content/uploads/2025/03/uncode.zip http://cktestplugins.wpengine.com/wp-content/uploads/2025/04/Divi.zip" + INSTALL_THEMES_URLS: "http://cktestplugins.wpengine.com/wp-content/uploads/2025/03/uncode.zip http://cktestplugins.wpengine.com/wp-content/uploads/2025/04/Divi.zip http://cktestplugins.wpengine.com/wp-content/uploads/2026/01/Impeka.zip" CONVERTKIT_API_KEY: ${{ secrets.CONVERTKIT_API_KEY }} # ConvertKit API Key, stored in the repository's Settings > Secrets CONVERTKIT_API_SECRET: ${{ secrets.CONVERTKIT_API_SECRET }} # ConvertKit API Secret, stored in the repository's Settings > Secrets CONVERTKIT_API_KEY_NO_DATA: ${{ secrets.CONVERTKIT_API_KEY_NO_DATA }} # ConvertKit API Key for ConvertKit account with no data, stored in the repository's Settings > Secrets diff --git a/includes/class-convertkit-output-restrict-content.php b/includes/class-convertkit-output-restrict-content.php index ac940b381..17e97b822 100644 --- a/includes/class-convertkit-output-restrict-content.php +++ b/includes/class-convertkit-output-restrict-content.php @@ -1227,21 +1227,24 @@ private function restrict_content( $content ) { $call_to_action = apply_filters( 'convertkit_output_restrict_content_call_to_action', $call_to_action, $this->post_id ); // Fetch container CSS classes. - $container_css_classes = $this->restrict_content_settings->get_by_key( 'container_css_classes' ); + $container_css_classes = explode( ' ', $this->restrict_content_settings->get_by_key( 'container_css_classes' ) ); /** * Define the container CSS classes to wrap the content preview and call to action within. * * @since 3.1.4 * - * @param string $container_css_classes Container CSS classes. - * @param int $post_id Post ID. + * @param array $container_css_classes Container CSS classes. + * @param int $post_id Post ID. */ $container_css_classes = apply_filters( 'convertkit_output_restrict_content_container_css_classes', $container_css_classes, $this->post_id ); + // Remove empty CSS classes. + $container_css_classes = array_filter( $container_css_classes ); + // If container CSS classes are set, return the content preview and call to action wrapped in the container. - if ( $container_css_classes ) { - return '
' . $content_preview . $call_to_action . '
'; + if ( count( $container_css_classes ) ) { + return '
' . $content_preview . $call_to_action . '
'; } // Return the content preview and its call to action. diff --git a/includes/functions.php b/includes/functions.php index 038248f23..6ad62e1e0 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -641,6 +641,32 @@ function convertkit_output_intercom_messenger() { } +/** + * Checks if the given Theme is active. + * + * @since 3.1.4 + * + * @param string $theme_name Theme name. + * @return bool + */ +function convertkit_is_theme_active( $theme_name ) { + + // Assume Theme isn't active if we can't detect it. + if ( ! function_exists( 'wp_get_theme' ) ) { + return false; + } + + // Check the Parent Theme if we're on a Child Theme. + if ( wp_get_theme()->parent() ) { + $theme = wp_get_theme()->parent(); + } else { + $theme = wp_get_theme(); + } + + return strtolower( $theme->get( 'Name' ) ) === strtolower( $theme_name ); + +} + /** * Returns permitted HTML output when using wp_kses( ..., convertkit_kses_allowed_html()). * diff --git a/includes/integrations/class-convertkit-impeka.php b/includes/integrations/class-convertkit-impeka.php new file mode 100644 index 000000000..90ba48ecb --- /dev/null +++ b/includes/integrations/class-convertkit-impeka.php @@ -0,0 +1,50 @@ +useTheme('twentytwentyfive'); } + /** + * Test that restricting content by a Product specified in the Page Settings works when + * creating and viewing a new WordPress Page using the Impeka theme automatically + * adds Impeka's grve-container CSS class to the Restrict Content container, + * ensuring correct layout. + * + * @since 3.1.4 + * + * @param EndToEndTester $I Tester. + */ + public function testRestrictContentByProductWithImpekaTheme(EndToEndTester $I) + { + // Activate theme. + $I->useTheme('impeka'); + + // Programmatically create a Page using the Visual Composer Page Builder. + $pageID = $I->havePostInDatabase( + [ + 'post_type' => 'page', + 'post_title' => 'Kit: Page: Restrict Content: Product: Impeka Theme with Visual Composer', + 'post_content' => 'Member-only content.', + + // Don't display a Form on this Page, so we test against Restrict Content's Form. + 'meta_input' => [ + '_wp_convertkit_post_meta' => [ + 'form' => '0', + 'landing_page' => '', + 'tag' => '', + 'restrict_content' => 'product_' . $_ENV['CONVERTKIT_API_PRODUCT_ID'], + ], + ], + ] + ); + + // Test Restrict Content functionality. + $I->testRestrictedContentByProductOnFrontend( + $I, + urlOrPageID: $pageID, + options: [ + 'visible_content' => '', + 'member_content' => 'Member-only content.', + 'settings' => [ + // Test that the grve-container CSS class is added to the Restrict Content container. + 'container_css_classes' => 'grve-container', + ], + ], + ); + + // Deactivate theme and third party Plugins. + $I->useTheme('twentytwentyfive'); + } + /** * Deactivate and reset Plugin(s) after each test, if the test passes. * We don't use _after, as this would provide a screenshot of the Plugin diff --git a/wp-convertkit.php b/wp-convertkit.php index 3e15d62fd..4641bce42 100644 --- a/wp-convertkit.php +++ b/wp-convertkit.php @@ -145,6 +145,9 @@ require_once CONVERTKIT_PLUGIN_PATH . '/includes/integrations/forminator/class-convertkit-forminator.php'; require_once CONVERTKIT_PLUGIN_PATH . '/includes/integrations/forminator/class-convertkit-forminator-settings.php'; +// Impeka Integration. +require_once CONVERTKIT_PLUGIN_PATH . '/includes/integrations/class-convertkit-impeka.php'; + // Uncode Integration. require_once CONVERTKIT_PLUGIN_PATH . '/includes/integrations/class-convertkit-uncode.php'; From 1193c43ecf7335cf76ba656968df34189c649c27 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Mon, 5 Jan 2026 15:43:35 +0800 Subject: [PATCH 2/8] Use filter, not action --- includes/integrations/class-convertkit-impeka.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/integrations/class-convertkit-impeka.php b/includes/integrations/class-convertkit-impeka.php index 90ba48ecb..42432c16c 100644 --- a/includes/integrations/class-convertkit-impeka.php +++ b/includes/integrations/class-convertkit-impeka.php @@ -21,7 +21,7 @@ class ConvertKit_Impeka { */ public function __construct() { - add_action( 'convertkit_output_restrict_content_container_css_classes', array( $this, 'maybe_add_restrict_content_container_css_classes' ) ); + add_filter( 'convertkit_output_restrict_content_container_css_classes', array( $this, 'maybe_add_restrict_content_container_css_classes' ) ); } From d6fcd9afd3c097c5a10036c455d421d9b21d5aa8 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Mon, 5 Jan 2026 15:43:40 +0800 Subject: [PATCH 3/8] Added integration tests --- tests/Integration/ThemeDetectionTest.php | 65 ++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 tests/Integration/ThemeDetectionTest.php diff --git a/tests/Integration/ThemeDetectionTest.php b/tests/Integration/ThemeDetectionTest.php new file mode 100644 index 000000000..cf0f50613 --- /dev/null +++ b/tests/Integration/ThemeDetectionTest.php @@ -0,0 +1,65 @@ +assertTrue(convertkit_is_theme_active( 'Twenty Twenty-Five' )); + $this->assertFalse(convertkit_is_theme_active( 'Impeka' )); + + // Switch Theme. + switch_theme('impeka'); + $this->assertFalse(convertkit_is_theme_active( 'Twenty Twenty-Five' )); + $this->assertTrue(convertkit_is_theme_active( 'Impeka' )); + } +} From 4e2b16899cfba18b904c33d2d29472992fbe5eac Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Mon, 5 Jan 2026 16:40:08 +0800 Subject: [PATCH 4/8] Fix test --- ...roductThirdPartyThemeOrPageBuilderCest.php | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php b/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php index a809d76fd..d06e89bbc 100644 --- a/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php +++ b/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php @@ -33,28 +33,25 @@ public function _before(EndToEndTester $I) /** * Test that restricting content by a Product specified in the Page Settings works when - * creating and viewing a new WordPress Page using the Uncode theme with - * the Visual Composer Page Builder. + * creating and viewing a new WordPress Page using the Impeka theme automatically + * adds Impeka's grve-container CSS class to the Restrict Content container, + * ensuring correct layout. * - * @since 2.7.7 + * @since 3.1.4 * * @param EndToEndTester $I Tester. */ - public function testRestrictContentByProductWithUncodeThemeAndVisualComposer(EndToEndTester $I) + public function testRestrictContentByProductWithImpekaTheme(EndToEndTester $I) { - // Activate theme and third party Plugins. - $I->useTheme('uncode'); - $I->activateThirdPartyPlugin($I, 'uncode-core'); - $I->activateThirdPartyPlugin($I, 'uncode-wpbakery-page-builder'); + // Activate theme. + $I->useTheme('impeka'); // Programmatically create a Page using the Visual Composer Page Builder. $pageID = $I->havePostInDatabase( [ 'post_type' => 'page', - 'post_title' => 'Kit: Page: Restrict Content: Product: Uncode Theme with Visual Composer', - - // Emulate Visual Composer content. - 'post_content' => '[vc_row][vc_column width="1/1"][vc_column_text uncode_shortcode_id="998876"]Member-only content.[/vc_column_text][/vc_column][/vc_row]', + 'post_title' => 'Kit: Page: Restrict Content: Product: Impeka Theme with Visual Composer', + 'post_content' => 'Member-only content.', // Don't display a Form on this Page, so we test against Restrict Content's Form. 'meta_input' => [ @@ -64,7 +61,6 @@ public function testRestrictContentByProductWithUncodeThemeAndVisualComposer(End 'tag' => '', 'restrict_content' => 'product_' . $_ENV['CONVERTKIT_API_PRODUCT_ID'], ], - '_wpb_vc_js_status' => 'true', ], ] ); @@ -76,40 +72,41 @@ public function testRestrictContentByProductWithUncodeThemeAndVisualComposer(End options: [ 'visible_content' => '', 'member_content' => 'Member-only content.', + 'settings' => [ + // Test that the grve-container CSS class is added to the Restrict Content container. + 'container_css_classes' => 'grve-container', + ], ], - // Don't check for warnings and notices, as Uncode uses deprecated functions which WordPress 6.9 warn about. - checkNoWarningsAndNotices: false ); // Deactivate theme and third party Plugins. - $I->deactivateThirdPartyPlugin($I, 'uncode-wpbakery-page-builder'); - $I->deactivateThirdPartyPlugin($I, 'uncode-core'); $I->useTheme('twentytwentyfive'); } /** * Test that restricting content by a Product specified in the Page Settings works when - * creating and viewing a new WordPress Page using the Uncode theme without + * creating and viewing a new WordPress Page using the Uncode theme with * the Visual Composer Page Builder. * * @since 2.7.7 * * @param EndToEndTester $I Tester. */ - public function testRestrictContentByProductWithUncodeTheme(EndToEndTester $I) + public function testRestrictContentByProductWithUncodeThemeAndVisualComposer(EndToEndTester $I) { // Activate theme and third party Plugins. $I->useTheme('uncode'); $I->activateThirdPartyPlugin($I, 'uncode-core'); + $I->activateThirdPartyPlugin($I, 'uncode-wpbakery-page-builder'); // Programmatically create a Page using the Visual Composer Page Builder. $pageID = $I->havePostInDatabase( [ 'post_type' => 'page', - 'post_title' => 'Kit: Page: Restrict Content: Product: Uncode Theme without Visual Composer', + 'post_title' => 'Kit: Page: Restrict Content: Product: Uncode Theme with Visual Composer', - // Emulate non-Visual Composer content. - 'post_content' => 'Member-only content.', + // Emulate Visual Composer content. + 'post_content' => '[vc_row][vc_column width="1/1"][vc_column_text uncode_shortcode_id="998876"]Member-only content.[/vc_column_text][/vc_column][/vc_row]', // Don't display a Form on this Page, so we test against Restrict Content's Form. 'meta_input' => [ @@ -119,6 +116,7 @@ public function testRestrictContentByProductWithUncodeTheme(EndToEndTester $I) 'tag' => '', 'restrict_content' => 'product_' . $_ENV['CONVERTKIT_API_PRODUCT_ID'], ], + '_wpb_vc_js_status' => 'true', ], ] ); @@ -136,30 +134,33 @@ public function testRestrictContentByProductWithUncodeTheme(EndToEndTester $I) ); // Deactivate theme and third party Plugins. + $I->deactivateThirdPartyPlugin($I, 'uncode-wpbakery-page-builder'); $I->deactivateThirdPartyPlugin($I, 'uncode-core'); $I->useTheme('twentytwentyfive'); } /** * Test that restricting content by a Product specified in the Page Settings works when - * creating and viewing a new WordPress Page using the Impeka theme automatically - * adds Impeka's grve-container CSS class to the Restrict Content container, - * ensuring correct layout. + * creating and viewing a new WordPress Page using the Uncode theme without + * the Visual Composer Page Builder. * - * @since 3.1.4 + * @since 2.7.7 * * @param EndToEndTester $I Tester. */ - public function testRestrictContentByProductWithImpekaTheme(EndToEndTester $I) + public function testRestrictContentByProductWithUncodeTheme(EndToEndTester $I) { - // Activate theme. - $I->useTheme('impeka'); + // Activate theme and third party Plugins. + $I->useTheme('uncode'); + $I->activateThirdPartyPlugin($I, 'uncode-core'); // Programmatically create a Page using the Visual Composer Page Builder. $pageID = $I->havePostInDatabase( [ 'post_type' => 'page', - 'post_title' => 'Kit: Page: Restrict Content: Product: Impeka Theme with Visual Composer', + 'post_title' => 'Kit: Page: Restrict Content: Product: Uncode Theme without Visual Composer', + + // Emulate non-Visual Composer content. 'post_content' => 'Member-only content.', // Don't display a Form on this Page, so we test against Restrict Content's Form. @@ -181,14 +182,13 @@ public function testRestrictContentByProductWithImpekaTheme(EndToEndTester $I) options: [ 'visible_content' => '', 'member_content' => 'Member-only content.', - 'settings' => [ - // Test that the grve-container CSS class is added to the Restrict Content container. - 'container_css_classes' => 'grve-container', - ], ], + // Don't check for warnings and notices, as Uncode uses deprecated functions which WordPress 6.9 warn about. + checkNoWarningsAndNotices: false ); // Deactivate theme and third party Plugins. + $I->deactivateThirdPartyPlugin($I, 'uncode-core'); $I->useTheme('twentytwentyfive'); } From e7c1774a18c03371852de48e7f8d0652810d9d28 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Mon, 5 Jan 2026 17:38:22 +0800 Subject: [PATCH 5/8] Tests: Fix Impeka theme folder letter casing --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d4d74d342..81883997f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,7 +32,7 @@ jobs: DB_HOST: localhost INSTALL_PLUGINS: "admin-menu-editor autoptimize beaver-builder-lite-version block-visibility contact-form-7 classic-editor custom-post-type-ui debloat elementor forminator jetpack-boost mailchimp-for-wp rocket-lazy-load woocommerce wordpress-seo wpforms-lite litespeed-cache wp-crontrol wp-super-cache w3-total-cache wp-fastest-cache wp-optimize sg-cachepress" # Don't include this repository's Plugin here. INSTALL_PLUGINS_URLS: "https://downloads.wordpress.org/plugin/convertkit-for-woocommerce.1.6.4.zip http://cktestplugins.wpengine.com/wp-content/uploads/2024/01/convertkit-action-filter-tests.zip http://cktestplugins.wpengine.com/wp-content/uploads/2024/11/disable-doing-it-wrong-notices.zip http://cktestplugins.wpengine.com/wp-content/uploads/2025/03/uncode-js_composer.7.8.zip http://cktestplugins.wpengine.com/wp-content/uploads/2025/03/uncode-core.zip" # URLs to specific third party Plugins - INSTALL_THEMES_URLS: "http://cktestplugins.wpengine.com/wp-content/uploads/2025/03/uncode.zip http://cktestplugins.wpengine.com/wp-content/uploads/2025/04/Divi.zip http://cktestplugins.wpengine.com/wp-content/uploads/2026/01/Impeka.zip" + INSTALL_THEMES_URLS: "http://cktestplugins.wpengine.com/wp-content/uploads/2025/03/uncode.zip http://cktestplugins.wpengine.com/wp-content/uploads/2025/04/Divi.zip http://cktestplugins.wpengine.com/wp-content/uploads/2026/01/impeka.zip" CONVERTKIT_API_KEY: ${{ secrets.CONVERTKIT_API_KEY }} # ConvertKit API Key, stored in the repository's Settings > Secrets CONVERTKIT_API_SECRET: ${{ secrets.CONVERTKIT_API_SECRET }} # ConvertKit API Secret, stored in the repository's Settings > Secrets CONVERTKIT_API_KEY_NO_DATA: ${{ secrets.CONVERTKIT_API_KEY_NO_DATA }} # ConvertKit API Key for ConvertKit account with no data, stored in the repository's Settings > Secrets From 83c211022f3c35d51e74e8da96685d355db5c91e Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Mon, 5 Jan 2026 18:30:43 +0800 Subject: [PATCH 6/8] Remove test --- ...roductThirdPartyThemeOrPageBuilderCest.php | 52 ------------------- 1 file changed, 52 deletions(-) diff --git a/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php b/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php index d06e89bbc..e53916605 100644 --- a/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php +++ b/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php @@ -31,58 +31,6 @@ public function _before(EndToEndTester $I) $I->setupKitPluginResources($I); } - /** - * Test that restricting content by a Product specified in the Page Settings works when - * creating and viewing a new WordPress Page using the Impeka theme automatically - * adds Impeka's grve-container CSS class to the Restrict Content container, - * ensuring correct layout. - * - * @since 3.1.4 - * - * @param EndToEndTester $I Tester. - */ - public function testRestrictContentByProductWithImpekaTheme(EndToEndTester $I) - { - // Activate theme. - $I->useTheme('impeka'); - - // Programmatically create a Page using the Visual Composer Page Builder. - $pageID = $I->havePostInDatabase( - [ - 'post_type' => 'page', - 'post_title' => 'Kit: Page: Restrict Content: Product: Impeka Theme with Visual Composer', - 'post_content' => 'Member-only content.', - - // Don't display a Form on this Page, so we test against Restrict Content's Form. - 'meta_input' => [ - '_wp_convertkit_post_meta' => [ - 'form' => '0', - 'landing_page' => '', - 'tag' => '', - 'restrict_content' => 'product_' . $_ENV['CONVERTKIT_API_PRODUCT_ID'], - ], - ], - ] - ); - - // Test Restrict Content functionality. - $I->testRestrictedContentByProductOnFrontend( - $I, - urlOrPageID: $pageID, - options: [ - 'visible_content' => '', - 'member_content' => 'Member-only content.', - 'settings' => [ - // Test that the grve-container CSS class is added to the Restrict Content container. - 'container_css_classes' => 'grve-container', - ], - ], - ); - - // Deactivate theme and third party Plugins. - $I->useTheme('twentytwentyfive'); - } - /** * Test that restricting content by a Product specified in the Page Settings works when * creating and viewing a new WordPress Page using the Uncode theme with From 4e0d6f892087cbad05ca4bbb26d167b30bcf6ae0 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Mon, 5 Jan 2026 18:34:12 +0800 Subject: [PATCH 7/8] Reinstate test --- ...roductThirdPartyThemeOrPageBuilderCest.php | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php b/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php index e53916605..6d5276b9b 100644 --- a/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php +++ b/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php @@ -31,6 +31,58 @@ public function _before(EndToEndTester $I) $I->setupKitPluginResources($I); } + /** + * Test that restricting content by a Product specified in the Page Settings works when + * creating and viewing a new WordPress Page using the Impeka theme automatically + * adds Impeka's grve-container CSS class to the Restrict Content container, + * ensuring correct layout. + * + * @since 3.1.4 + * + * @param EndToEndTester $I Tester. + */ + public function testRestrictContentByProductWithImpekaTheme(EndToEndTester $I) + { + // Activate theme. + $I->useTheme('impeka'); + + // Programmatically create a Page using the Visual Composer Page Builder. + $pageID = $I->havePostInDatabase( + [ + 'post_type' => 'page', + 'post_title' => 'Kit: Page: Restrict Content: Product: Impeka Theme with Visual Composer', + 'post_content' => 'Member-only content.', + + // Don't display a Form on this Page, so we test against Restrict Content's Form. + 'meta_input' => [ + '_wp_convertkit_post_meta' => [ + 'form' => '0', + 'landing_page' => '', + 'tag' => '', + 'restrict_content' => 'product_' . $_ENV['CONVERTKIT_API_PRODUCT_ID'], + ], + ], + ] + ); + + // Test Restrict Content functionality. + $I->testRestrictedContentByProductOnFrontend( + $I, + urlOrPageID: $pageID, + options: [ + 'visible_content' => '', + 'member_content' => 'Member-only content.', + 'settings' => [ + // Test that the grve-container CSS class is added to the Restrict Content container. + 'container_css_classes' => 'grve-container', + ], + ], + ); + + // Deactivate theme. + $I->useTheme('twentytwentyfive'); + } + /** * Test that restricting content by a Product specified in the Page Settings works when * creating and viewing a new WordPress Page using the Uncode theme with From 14d4fe7338d104e082936e0cfef84461b49d2e7e Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Tue, 6 Jan 2026 11:13:51 +0800 Subject: [PATCH 8/8] =?UTF-8?q?Tests:=20Don=E2=80=99t=20deactivate=20theme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RestrictContentProductThirdPartyThemeOrPageBuilderCest.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php b/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php index 01aa33834..800cc3454 100644 --- a/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php +++ b/tests/EndToEnd/restrict-content/post-types/RestrictContentProductThirdPartyThemeOrPageBuilderCest.php @@ -78,9 +78,6 @@ public function testRestrictContentByProductWithImpekaTheme(EndToEndTester $I) ], ], ); - - // Deactivate theme. - $I->useTheme('twentytwentyfive'); } /**