PluginProbe
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder / 51.1.86
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder v51.1.86
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 51.1.45 All 40 releases
← All changes | includes/wishlist/Wishlist_Service.php +26 -9 51.1.78 → 51.1.86 View file →
@@ -241,9 +241,17 @@
241 241 $this->ensure_default_list(self::DEFAULT_WISHLIST_ID);
242 242 $lists = $wpdb->get_results("SELECT * FROM {$lists_table} WHERE {$where} ORDER BY created_at DESC");
243 243 }
244 244
245 - return $lists ?: [];
245 + $unique = [];
246 + foreach ($lists ?: [] as $list) {
247 + $key = (string) ($list->slug ?: $list->id);
248 + if (!isset($unique[$key])) {
249 + $unique[$key] = $list;
250 + }
251 + }
252 +
253 + return array_values($unique);
246 254 }
247 255
248 256 /**
249 257 * Create a new wishlist record.
@@ -609,16 +617,25 @@
609 617 global $wpdb;
610 618
611 619 $lists_table = Wishlist_DB::get_lists_table();
612 620
613 - $existing_row = $wpdb->get_var(
614 - $wpdb->prepare(
615 - "SELECT id FROM {$lists_table} WHERE (user_id = %d OR session_key = %s) AND slug = %s LIMIT 1",
616 - $this->user_id,
617 - $this->session_key,
618 - $wishlist_id
619 - )
620 - );
621 + if ($this->user_id > 0) {
622 + $existing_row = $wpdb->get_var(
623 + $wpdb->prepare(
624 + "SELECT id FROM {$lists_table} WHERE user_id = %d AND slug = %s LIMIT 1",
625 + $this->user_id,
626 + $wishlist_id
627 + )
628 + );
629 + } else {
630 + $existing_row = $wpdb->get_var(
631 + $wpdb->prepare(
632 + "SELECT id FROM {$lists_table} WHERE user_id = 0 AND session_key = %s AND slug = %s LIMIT 1",
633 + $this->session_key,
634 + $wishlist_id
635 + )
636 + );
637 + }
621 638
622 639 if ($existing_row) {
623 640 return;
624 641 }