From dd5eabc5c2eec818c44c1305daaa0f66bae0ef86 Mon Sep 17 00:00:00 2001 From: Clayton Collie Date: Sat, 21 Feb 2026 09:23:04 +0100 Subject: [PATCH 1/3] Add hosting provider detection, multisite flag, and user profile URLs - Add get_hosting_provider() method that detects platform via PHP constants (VIP, Kinsta, WP Engine, Pantheon, Pagely, Flywheel, Cloudways) - Refactor get_is_using_object_cache() VIP check to use centralized detection - Add hosting_provider and is_multisite to report customData - Add profileUrl (wp-admin search URL) to each user in get_users() - Fix db_version using method call instead of non-existent property Co-Authored-By: Claude Opus 4.6 --- includes/classes/SupportMonitor/Monitor.php | 76 +++++++++++++++++---- 1 file changed, 64 insertions(+), 12 deletions(-) diff --git a/includes/classes/SupportMonitor/Monitor.php b/includes/classes/SupportMonitor/Monitor.php index 6697c5a..2a3b00d 100644 --- a/includes/classes/SupportMonitor/Monitor.php +++ b/includes/classes/SupportMonitor/Monitor.php @@ -448,7 +448,7 @@ public function send_daily_report() { ], [ 'key' => 'db_version', - 'value' => ( isset( $wpdb->db_version ) ) ? $wpdb->db_version : '', + 'value' => $wpdb->db_version() ?: '', 'group' => 'system', ], [ @@ -466,6 +466,16 @@ public function send_daily_report() { 'value' => $this->xmlrpc_enabled(), 'group' => 'system', ], + [ + 'key' => 'hosting_provider', + 'value' => $this->get_hosting_provider(), + 'group' => 'system', + ], + [ + 'key' => 'is_multisite', + 'value' => is_multisite(), + 'group' => 'system', + ], ]; $body = [ @@ -706,7 +716,8 @@ public function get_php_version() { * @return array */ public function get_users() { - $users = []; + $users = []; + $users_url = is_multisite() ? network_admin_url( 'users.php' ) : admin_url( 'users.php' ); $args = [ 'search' => '*@get10up.com', @@ -723,9 +734,10 @@ public function get_users() { foreach ( $_users as $user ) { $users[] = [ - 'email' => $user->user_email, - 'name' => $user->display_name, - 'role' => array_values( $user->roles ), + 'email' => $user->user_email, + 'name' => $user->display_name, + 'role' => array_values( $user->roles ), + 'profileUrl' => add_query_arg( 's', $user->user_email, $users_url ), ]; } @@ -744,9 +756,10 @@ public function get_users() { foreach ( $_users as $user ) { $users[] = [ - 'email' => $user->user_email, - 'name' => $user->display_name, - 'role' => array_values( $user->roles ), + 'email' => $user->user_email, + 'name' => $user->display_name, + 'role' => array_values( $user->roles ), + 'profileUrl' => add_query_arg( 's', $user->user_email, $users_url ), ]; } @@ -765,15 +778,54 @@ public function get_users() { foreach ( $_users as $user ) { $users[] = [ - 'email' => $user->user_email, - 'name' => $user->display_name, - 'role' => array_values( $user->roles ), + 'email' => $user->user_email, + 'name' => $user->display_name, + 'role' => array_values( $user->roles ), + 'profileUrl' => add_query_arg( 's', $user->user_email, $users_url ), ]; } return $users; } + /** + * Detect the hosting provider based on platform-specific PHP constants. + * + * @since 2.2 + * @return string Hosting provider slug (e.g. 'vip', 'kinsta') or 'unknown'. + */ + public function get_hosting_provider() { + if ( defined( 'WPCOM_IS_VIP_ENV' ) || defined( 'VIP_GO_APP_ENVIRONMENT' ) ) { + return 'vip'; + } + + if ( defined( 'KINSTA_DEV_ENV' ) || defined( 'KINSTA_CACHE_ZONE' ) ) { + return 'kinsta'; + } + + if ( defined( 'WPE_APIKEY' ) || defined( 'IS_WPE' ) ) { + return 'wpengine'; + } + + if ( defined( 'PANTHEON_ENVIRONMENT' ) ) { + return 'pantheon'; + } + + if ( defined( 'STARTER_STARTER' ) || defined( 'JEEVES_ENV' ) ) { + return 'pagely'; + } + + if ( defined( 'FLYWHEEL_CONFIG_DIR' ) ) { + return 'flywheel'; + } + + if ( defined( 'CLOUDWAYS_SERVER_ID' ) ) { + return 'cloudways'; + } + + return 'unknown'; + } + /** * Check if the site is using an external object cache. * @@ -785,7 +837,7 @@ public function get_is_using_object_cache() { } // If this is a VIP site, we can assume they are using an object cache. - if ( defined( 'VIP_GO_APP_ENVIRONMENT' ) && 'local' !== VIP_GO_APP_ENVIRONMENT ) { + if ( 'vip' === $this->get_hosting_provider() ) { return true; } From 55bc194a59626cc9f6833c8e5ad16871560503f7 Mon Sep 17 00:00:00 2001 From: Clayton Collie Date: Sat, 21 Feb 2026 09:26:41 +0100 Subject: [PATCH 2/3] Fix PHPCS: replace short ternary and fix alignment Co-Authored-By: Claude Opus 4.6 --- includes/classes/SupportMonitor/Monitor.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/classes/SupportMonitor/Monitor.php b/includes/classes/SupportMonitor/Monitor.php index 2a3b00d..55e531a 100644 --- a/includes/classes/SupportMonitor/Monitor.php +++ b/includes/classes/SupportMonitor/Monitor.php @@ -448,7 +448,7 @@ public function send_daily_report() { ], [ 'key' => 'db_version', - 'value' => $wpdb->db_version() ?: '', + 'value' => $wpdb->db_version() ? $wpdb->db_version() : '', 'group' => 'system', ], [ @@ -716,7 +716,7 @@ public function get_php_version() { * @return array */ public function get_users() { - $users = []; + $users = []; $users_url = is_multisite() ? network_admin_url( 'users.php' ) : admin_url( 'users.php' ); $args = [ From 7f02a266421bbb6dbe3c385564fb8a377e6d02b5 Mon Sep 17 00:00:00 2001 From: Clayton Collie Date: Fri, 27 Feb 2026 10:09:20 +0100 Subject: [PATCH 3/3] Move hostingProvider and isMultisite from customData to top-level body These are static environment metadata that belong as first-class fields in the POST payload rather than embedded in the customData array. Monitor reads them directly with a backward-compatible fallback. Co-Authored-By: Claude Opus 4.6 --- includes/classes/SupportMonitor/Monitor.php | 24 +++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/includes/classes/SupportMonitor/Monitor.php b/includes/classes/SupportMonitor/Monitor.php index 55e531a..9e69cde 100644 --- a/includes/classes/SupportMonitor/Monitor.php +++ b/includes/classes/SupportMonitor/Monitor.php @@ -466,25 +466,17 @@ public function send_daily_report() { 'value' => $this->xmlrpc_enabled(), 'group' => 'system', ], - [ - 'key' => 'hosting_provider', - 'value' => $this->get_hosting_provider(), - 'group' => 'system', - ], - [ - 'key' => 'is_multisite', - 'value' => is_multisite(), - 'group' => 'system', - ], ]; $body = [ - 'url' => TENUP_EXPERIENCE_IS_NETWORK ? network_home_url() : home_url(), - 'platform' => 'wordpress', - 'packages' => $this->get_packages(), - 'activityLogs' => $logs, - 'customData' => $custom_data, - 'users' => $this->get_users(), + 'url' => TENUP_EXPERIENCE_IS_NETWORK ? network_home_url() : home_url(), + 'platform' => 'wordpress', + 'hostingProvider' => $this->get_hosting_provider(), + 'isMultisite' => is_multisite(), + 'packages' => $this->get_packages(), + 'activityLogs' => $logs, + 'customData' => $custom_data, + 'users' => $this->get_users(), ]; $this->send_request( $body );