From c665dfb77745bc5108c529f23faef449e957e256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vytis=20Bulkevi=C4=8Dius?= Date: Wed, 4 Nov 2026 19:07:18 +0200 Subject: [PATCH] feat: opt into the Themeisle SDK Support Hub --- composer.json | 2 +- composer.lock | 2 +- inc/admin/dashboard/main.php | 30 ++++++++++++ tests/test-neve-support-hub.php | 86 +++++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 tests/test-neve-support-hub.php diff --git a/composer.json b/composer.json index 136112a86e..0a25a5b2ff 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "source": "https://github.com/Codeinwp/neve" }, "require": { - "codeinwp/themeisle-sdk": "^3.3.65", + "codeinwp/themeisle-sdk": "^3.3.71", "wptt/webfont-loader": "dev-master" }, "repositories": [ diff --git a/composer.lock b/composer.lock index 1ec7b57a93..5b41ae6d11 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "51e5f5e9a599a2c93513e76c50580217", + "content-hash": "c49876fd8509ff554d8ec9c95237ebf4", "packages": [ { "name": "codeinwp/themeisle-sdk", diff --git a/inc/admin/dashboard/main.php b/inc/admin/dashboard/main.php index 509c9eb1c2..d18620cc9e 100755 --- a/inc/admin/dashboard/main.php +++ b/inc/admin/dashboard/main.php @@ -106,6 +106,7 @@ public function init() { add_action( 'init', array( $this, 'register_settings' ) ); add_action( 'init', array( $this, 'register_about_page' ), 1 ); add_filter( 'neve_ai_connect_metadata', array( $this, 'get_ai_connect_metadata' ) ); + add_filter( 'neve_support_hub_metadata', array( $this, 'get_support_hub_metadata' ) ); add_action( 'admin_notices', array( $this, 'render_custom_layout_header' ) ); } @@ -136,6 +137,35 @@ public function get_ai_connect_metadata() { ]; } + /** + * Get the data for the SDK Support Hub: one Help button on the Neve dashboard + * and the feedback window on the Add Themes screen. The dashboard already fires + * `themeisle_internal_page`, so no `pages` list is needed. + * + * @return array>> + */ + public function get_support_hub_metadata() { + if ( apply_filters( 'neve_is_theme_whitelabeled', false ) || apply_filters( 'neve_is_plugin_whitelabeled', false ) ) { + return []; + } + + return [ + 'is_pro' => defined( 'NEVE_PRO_VERSION' ) && 'valid' === apply_filters( 'product_neve_license_status', false ), + 'links' => [ + [ + 'icon' => 'book-alt', + 'text' => __( 'Documentation', 'neve' ), + 'url' => 'https://docs.themeisle.com/neve/neve-doc', + ], + [ + 'icon' => 'groups', + 'text' => __( 'Community Forum', 'neve' ), + 'url' => 'https://wordpress.org/support/theme/neve/', + ], + ], + ]; + } + /** * Add the about page with respect to the white label settings. * diff --git a/tests/test-neve-support-hub.php b/tests/test-neve-support-hub.php new file mode 100644 index 0000000000..976612926d --- /dev/null +++ b/tests/test-neve-support-hub.php @@ -0,0 +1,86 @@ +assertIsArray( $data ); + $this->assertSame( array( 'is_pro', 'links' ), array_keys( $data ) ); + $this->assertArrayNotHasKey( 'setup_complete', $data, 'The setup nudge stays off for now.' ); + } + + /** + * The footer links point to Neve's docs and wordpress.org forum. + */ + public function test_links_point_to_neve() { + $links = apply_filters( 'neve_support_hub_metadata', array() )['links']; + + $this->assertSame( + array( + 'https://docs.themeisle.com/neve/neve-doc', + 'https://wordpress.org/support/theme/neve/', + ), + wp_list_pluck( $links, 'url' ) + ); + foreach ( $links as $link ) { + $this->assertNotEmpty( $link['icon'] ); + $this->assertNotEmpty( $link['text'] ); + } + } + + /** + * Messages are tagged as Pro only while Neve Pro is active with a valid license. + */ + public function test_is_pro_needs_a_valid_license() { + add_filter( 'product_neve_license_status', array( $this, 'expired_license' ) ); + $this->assertFalse( apply_filters( 'neve_support_hub_metadata', array() )['is_pro'] ); + remove_filter( 'product_neve_license_status', array( $this, 'expired_license' ) ); + + add_filter( 'product_neve_license_status', array( $this, 'valid_license' ) ); + $this->assertSame( defined( 'NEVE_PRO_VERSION' ), apply_filters( 'neve_support_hub_metadata', array() )['is_pro'] ); + remove_filter( 'product_neve_license_status', array( $this, 'valid_license' ) ); + } + + /** + * A white-labeled Neve shows no Themeisle Help button. + */ + public function test_white_label_hides_the_hub() { + add_filter( 'neve_is_theme_whitelabeled', '__return_true' ); + $this->assertSame( array(), apply_filters( 'neve_support_hub_metadata', array() ) ); + remove_filter( 'neve_is_theme_whitelabeled', '__return_true' ); + + add_filter( 'neve_is_plugin_whitelabeled', '__return_true' ); + $this->assertSame( array(), apply_filters( 'neve_support_hub_metadata', array() ) ); + remove_filter( 'neve_is_plugin_whitelabeled', '__return_true' ); + } + + /** + * Reports a valid license. + * + * @return string + */ + public function valid_license() { + return 'valid'; + } + + /** + * Reports an expired license. + * + * @return string + */ + public function expired_license() { + return 'expired'; + } +}