Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit e2bd804

Browse files
author
Matt Allan
committed
Fixes notices being displayed on WordPress 6.7 due to loading translations too early. (#730)
* Remove unnecessary call to check if feature exists - fixes WP 6.7 compat * Fix early translation calls in our privacy exporter/eraser class * Register caching debug tools after init to fix translation issues * Add changelog entry
1 parent 07bf070 commit e2bd804

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
*** WooCommerce Subscriptions Core Changelog ***
22

3+
= 7.7.2 - xxxx-xx-xx =
4+
* Fix - Prevents notices being displayed on WordPress 6.7 due to loading translations too early.
5+
36
= 7.7.1 - 2024-11-13 =
47
* Fix - Only show the individual subscription information in customer notification emails, not all subscriptions purchased in the initial order.
58
* Fix - Resolved issues with Customer Notification emails not being sent due to unsupported emoji used in the default email subject.

includes/data-stores/class-wcs-customer-store-cached-cpt.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,20 @@ protected function init() {
7070

7171
$this->object_data_cache_manager->init();
7272

73+
add_action( 'init', array( $this, 'register_debug_tools' ) );
74+
7375
// When a user is first added, make sure the subscription cache is empty because it can not have any data yet, and we want to avoid running the query needlessly
7476
add_filter( 'user_register', array( $this, 'set_empty_cache' ) );
7577

7678
// When the post for a subscription is change, make sure the corresponding cache is updated
7779
add_action( 'wcs_update_post_meta_caches', array( $this, 'maybe_update_for_post_meta_change' ), 10, 5 );
7880
add_action( 'wcs_delete_all_post_meta_caches', array( $this, 'maybe_delete_all_for_post_meta_change' ), 10, 1 );
81+
}
7982

83+
/**
84+
* Register debug tools for managing the cache.
85+
*/
86+
public function register_debug_tools() {
8087
WCS_Debug_Tool_Factory::add_cache_tool( 'generator', __( 'Generate Customer Subscription Cache', 'woocommerce-subscriptions' ), __( 'This will generate the persistent cache for linking users with subscriptions. The caches will be generated overtime in the background (via Action Scheduler).', 'woocommerce-subscriptions' ), self::instance() );
8188
WCS_Debug_Tool_Factory::add_cache_tool( 'eraser', __( 'Delete Customer Subscription Cache', 'woocommerce-subscriptions' ), __( 'This will clear the persistent cache of all of subscriptions stored against users in your store. Expect slower performance of checkout, renewal and other subscription related functions after taking this action. The caches will be regenerated overtime as queries to find a given user\'s subscriptions are run.', 'woocommerce-subscriptions' ), self::instance() );
8289
}

includes/data-stores/class-wcs-related-order-store-cached-cpt.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ protected function init() {
9292

9393
$this->object_data_cache_manager->init();
9494

95+
add_action( 'init', array( $this, 'register_debug_tools' ) );
96+
9597
// When a subscription is being read from the database, don't load cached related order meta data into subscriptions.
9698
add_filter( 'wcs_subscription_data_store_props_to_ignore', array( $this, 'add_related_order_cache_props' ), 10, 2 );
9799

@@ -104,7 +106,12 @@ protected function init() {
104106

105107
// When copying meta from a subscription to a renewal order, don't copy cache related order meta keys.
106108
add_filter( 'wc_subscriptions_renewal_order_data', array( $this, 'remove_related_order_cache_keys' ), 10, 1 );
109+
}
107110

111+
/**
112+
* Register debug tools for managing the cache.
113+
*/
114+
public function register_debug_tools() {
108115
WCS_Debug_Tool_Factory::add_cache_tool( 'generator', __( 'Generate Related Order Cache', 'woocommerce-subscriptions' ), __( 'This will generate the persistent cache of all renewal, switch, resubscribe and other order types for all subscriptions in your store. The caches will be generated overtime in the background (via Action Scheduler).', 'woocommerce-subscriptions' ), self::instance() );
109116
WCS_Debug_Tool_Factory::add_cache_tool( 'eraser', __( 'Delete Related Order Cache', 'woocommerce-subscriptions' ), __( 'This will clear the persistent cache of all renewal, switch, resubscribe and other order types for all subscriptions in your store. Expect slower performance of checkout, renewal and other subscription related functions after taking this action. The caches will be regenerated overtime as related order queries are run.', 'woocommerce-subscriptions' ), self::instance() );
110117
}

includes/privacy/class-wcs-privacy.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,16 @@ public function __construct() {
3737
self::$background_process = new WCS_Privacy_Background_Updater();
3838
}
3939

40-
parent::__construct( __( 'WooCommerce Subscriptions', 'woocommerce-subscriptions' ) );
40+
parent::__construct();
41+
42+
add_action( 'init', array( $this, 'register_erasers_exporters' ) );
43+
}
44+
45+
/**
46+
* Register erasers and exporters.
47+
*/
48+
public function register_erasers_exporters() {
49+
$this->name = __( 'WooCommerce Subscriptions', 'woocommerce-subscriptions' );
4150

4251
// Add our exporters and erasers.
4352
$this->add_exporter( 'woocommerce-subscriptions-data', __( 'Subscriptions Data', 'woocommerce-subscriptions' ), array( 'WCS_Privacy_Exporters', 'subscription_data_exporter' ) );

includes/wcs-compatibility-functions.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -603,11 +603,7 @@ function wcs_is_wc_feature_enabled( $feature_name ) {
603603
* @return bool
604604
*/
605605
function wcs_is_custom_order_tables_usage_enabled() {
606-
if ( ! class_exists( '\Automattic\WooCommerce\Utilities\OrderUtil' ) || ! wcs_is_wc_feature_enabled( 'custom_order_tables' ) ) {
607-
return false;
608-
}
609-
610-
return \Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled();
606+
return class_exists( '\Automattic\WooCommerce\Utilities\OrderUtil' ) && \Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled();
611607
}
612608

613609
/**

0 commit comments

Comments
 (0)