From 325b1d58b65a6abc8001e3a2af62f2b47ce213c7 Mon Sep 17 00:00:00 2001 From: Michael Beckwith Date: Mon, 13 Jul 2026 12:47:23 -0500 Subject: [PATCH 1/3] versions 2.19.0 to 2.21.0, delete stored hash value to allow for new hashes without protocols. --- includes/class-updates.php | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/includes/class-updates.php b/includes/class-updates.php index b5d6526f5..e6d7fe3fc 100644 --- a/includes/class-updates.php +++ b/includes/class-updates.php @@ -59,7 +59,7 @@ public function check_for_update_needed() { $installed = get_option( 'ctct_plugin_version', '0.0.0' ); $current = esc_attr( $this->plugin->version ); - if ( ! version_compare( $current, $installed, '<' ) ) { + if ( ! version_compare( $current, $installed, '<' ) && $current !== $installed ) { update_option( 'ctct_plugin_version', $current, true ); @@ -111,4 +111,36 @@ public function add_notification( string $update_id ) { } } + /** + * Version 2.19.0 to 2.22.0. + * + * Force delete this option value due to changing how much gets hashed. + * + * @since 2.22.0 + */ + public function run_update_v2_19_0_to_v2_22_0() { + update_option( 'ctct_account_domain_hash', '' ); + } + + /** + * Version 2.20.0 to 2.22.0 + * + * Force delete this option value due to changing how much gets hashed. + * + * @since 2.22.0 + */ + public function run_update_v2_20_0_to_v2_22_0() { + update_option( 'ctct_account_domain_hash', '' ); + } + + /** + * Version 2.21.0 to 2.22.0 + * + * Force delete this option value due to changing how much gets hashed. + * + * @since 2.22.0 + */ + public function run_update_v2_21_0_to_v2_22_0() { + update_option( 'ctct_account_domain_hash', '' ); + } } From 9c6f602ef3eb21ac63ddbca30171553b2a05fadd Mon Sep 17 00:00:00 2001 From: Michael Beckwith Date: Mon, 13 Jul 2026 12:47:51 -0500 Subject: [PATCH 2/3] remove protocol from site url to help with cases of http vs https requests --- includes/class-api-utility.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-api-utility.php b/includes/class-api-utility.php index 03bfe093d..b564e04bc 100644 --- a/includes/class-api-utility.php +++ b/includes/class-api-utility.php @@ -196,7 +196,7 @@ public function parse_access_token_data( string $access_token ) { return []; } $connecting_account['account'] = $parsed_payload_data['sub']; - $connecting_account['site'] = get_site_url(); + $connecting_account['site'] = parse_url( get_site_url(), PHP_URL_HOST ); } return $connecting_account; From 1edf14941f4f83940d59ed6c44a986e6224024d4 Mon Sep 17 00:00:00 2001 From: Michael Beckwith Date: Mon, 13 Jul 2026 12:58:54 -0500 Subject: [PATCH 3/3] phpcs while we are here --- includes/class-updates.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/class-updates.php b/includes/class-updates.php index e6d7fe3fc..9712033d9 100644 --- a/includes/class-updates.php +++ b/includes/class-updates.php @@ -42,7 +42,7 @@ public function __construct( object $plugin ) { * * @since 1.0.0 */ - public function hooks() { + public function hooks(): void { if ( is_admin() ) { add_action( 'plugins_loaded', [ $this, 'check_for_update_needed' ] ); } @@ -54,7 +54,7 @@ public function hooks() { * * @since 1.0.0 */ - public function check_for_update_needed() { + public function check_for_update_needed(): void { $installed = get_option( 'ctct_plugin_version', '0.0.0' ); $current = esc_attr( $this->plugin->version ); @@ -88,7 +88,7 @@ public function check_for_update_needed() { * * @param string $update_id Update key to use for version. */ - public function add_notification( string $update_id ) { + public function add_notification( string $update_id ): void { $current_notifs = get_option( 'ctct_update_notifications', [] ); $compare_notifs = $current_notifs; @@ -118,7 +118,7 @@ public function add_notification( string $update_id ) { * * @since 2.22.0 */ - public function run_update_v2_19_0_to_v2_22_0() { + public function run_update_v2_19_0_to_v2_22_0(): void { update_option( 'ctct_account_domain_hash', '' ); } @@ -129,7 +129,7 @@ public function run_update_v2_19_0_to_v2_22_0() { * * @since 2.22.0 */ - public function run_update_v2_20_0_to_v2_22_0() { + public function run_update_v2_20_0_to_v2_22_0(): void { update_option( 'ctct_account_domain_hash', '' ); } @@ -140,7 +140,7 @@ public function run_update_v2_20_0_to_v2_22_0() { * * @since 2.22.0 */ - public function run_update_v2_21_0_to_v2_22_0() { + public function run_update_v2_21_0_to_v2_22_0(): void { update_option( 'ctct_account_domain_hash', '' ); } }