From 18ea86d934229117f0be75cf7ed70ca53f82930b Mon Sep 17 00:00:00 2001 From: Kiran Prajapati Date: Fri, 22 Nov 2024 16:56:54 +0530 Subject: [PATCH] WordPress 6.7 compatibility changes for translation - CHANGED --- includes/class-userswp.php | 4 ++-- includes/class-uwp-privacy.php | 10 ++++++++++ readme.txt | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/includes/class-userswp.php b/includes/class-userswp.php index 8cc99ac1..c4c8aa90 100755 --- a/includes/class-userswp.php +++ b/includes/class-userswp.php @@ -499,7 +499,7 @@ private function init_hooks() { add_action( 'admin_init', array( 'UsersWP_Activator', 'automatic_upgrade' ) ); add_action( 'init', array( 'UsersWP_Activator', 'init_background_updater' ), 5 ); add_action( 'widgets_init', array( $this, 'register_widgets' ) ); - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); + add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ) ); add_action( 'uwp_flush_rewrite_rules', array( $this, 'flush_rewrite_rules' ) ); add_action( 'uwp_language_file_add_string', array( $this, 'register_string' ), 10, 1 ); add_action( 'after_setup_theme', array( $this, 'hide_admin_bar' )); @@ -905,7 +905,7 @@ public function load_plugin_textdomain() { */ $locale = apply_filters( 'plugin_locale', $locale, 'userswp' ); - unload_textdomain( 'userswp' ); + unload_textdomain( 'userswp', true ); load_textdomain( 'userswp', WP_LANG_DIR . '/userswp/userswp-' . $locale . '.mo' ); load_plugin_textdomain( 'userswp', false, plugin_basename( dirname( USERSWP_PLUGIN_FILE ) ) . '/languages/' ); diff --git a/includes/class-uwp-privacy.php b/includes/class-uwp-privacy.php index ec4441a1..480383b6 100644 --- a/includes/class-uwp-privacy.php +++ b/includes/class-uwp-privacy.php @@ -20,6 +20,16 @@ public function __construct() { include_once 'class-uwp-privacy-exporters.php'; include_once 'class-uwp-privacy-erasers.php'; + // Initialize data exporters and erasers. + add_action( 'init', array( $this, 'register_erasers_exporters' ) ); + } + + /** + * Initial registration of privacy erasers and exporters. + * + * Due to the use of translation functions, this should run only after plugins loaded. + */ + public function register_erasers_exporters() { // This hook registers userswp data exporters. $this->add_exporter( 'uwp-customer-data', __( 'UsersWP User Data', 'userswp' ), array( 'UsersWP_Privacy_Exporters', 'user_data_exporter' ) ); diff --git a/readme.txt b/readme.txt index 6e1e9784..629729ba 100644 --- a/readme.txt +++ b/readme.txt @@ -146,6 +146,9 @@ Yes, you can customize it with Elementor, but also with Gutenberg, Divi, Beaver == Changelog == += 1.2.22 - TBD = +* WordPress 6.7 compatibility changes for translation - CHANGED + = 1.2.21 - 2024-11-12 = * Update AUI & SD - CHANGED