PluginProbe
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder / 51.1.87
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder v51.1.87
51.1.87 51.1.86 51.1.84 51.1.85 51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 All 41 releases
← All changes | includes/wishlist/Wishlist_Module.php +24 -1 51.1.79 → 51.1.87 View file →
@@ -22,13 +22,28 @@
22 22 * Hook module initialization.
23 23 */
24 24 public function __construct()
25 25 {
26 + add_action('send_headers', [$this, 'maybe_expire_cookie']);
26 27 add_action('init', [$this, 'boot']);
27 28 add_action('wp_login', [$this, 'handle_login'], 10, 2);
28 29 }
29 30
30 31 /**
32 + * Drop leftover guest cookies when wishlist is turned off in settings.
33 + *
34 + * @return void
35 + */
36 + public function maybe_expire_cookie(): void
37 + {
38 + if (Wishlist_Settings::is_enabled() || is_admin()) {
39 + return;
40 + }
41 +
42 + Wishlist_Session::expire_if_present();
43 + }
44 +
45 + /**
31 46 * Initialize wishlist module on init.
32 47 *
33 48 * @return void
34 49 */
@@ -34,8 +49,9 @@
34 49 */
35 50 public function boot(): void
36 51 {
37 52 Wishlist_DB::maybe_create_tables();
53 + Wishlist_Settings::maybe_disable_archive_buttons();
38 54 $this->service = new Wishlist_Service();
39 55 $this->renderer = new Wishlist_Renderer($this->service);
40 56 $this->woocommerce = new Wishlist_WooCommerce($this->service, $this->renderer);
41 57 $this->woocommerce->hooks();
@@ -58,10 +74,17 @@
58 74 * @return void
59 75 */
60 76 public function handle_login(string $user_login, WP_User $user): void
61 77 {
78 + if (!Wishlist_Settings::is_enabled()) {
79 + return;
80 + }
81 +
62 82 $session = new Wishlist_Session();
63 - $session_key = $session->get_session_key();
83 + $session_key = $session->get_session_key(false);
84 + if ($session_key === '') {
85 + return;
86 + }
64 87
65 88 $service = new Wishlist_Service($user->ID, $session_key);
66 89 $service->merge_guest_items($user->ID, $session_key);
67 90 }