diff --git a/includes/class-forum-ajax.php b/includes/class-forum-ajax.php index b0a9f6d..d166a83 100644 --- a/includes/class-forum-ajax.php +++ b/includes/class-forum-ajax.php @@ -720,6 +720,15 @@ class WBF_Ajax { if ( ! $user ) wp_send_json_error(['message' => 'Nicht eingeloggt.']); $notifs = WBF_DB::get_notifications( $user->id, 20 ); $unread = WBF_DB::count_unread_notifications( $user->id ); + + // Plugin-Update Notifications: Permalink + Thumbnail ergänzen + foreach ( $notifs as $n ) { + if ( $n->type === 'plugin_update' && ! empty( $n->object_id ) ) { + $n->plugin_url = get_permalink( (int) $n->object_id ) ?: ''; + $n->plugin_thumb = get_the_post_thumbnail_url( (int) $n->object_id, 'thumbnail' ) ?: ''; + } + } + wp_send_json_success(['notifications' => $notifs, 'unread' => $unread]); } diff --git a/includes/class-forum-db.php b/includes/class-forum-db.php index 91ce1a1..802ce53 100644 --- a/includes/class-forum-db.php +++ b/includes/class-forum-db.php @@ -880,10 +880,17 @@ class WBF_DB { return $wpdb->get_results( $wpdb->prepare( "SELECT n.*, u.display_name AS actor_name, u.avatar_url AS actor_avatar, - t.title AS thread_title, t.id AS thread_id + t.title AS thread_title, t.id AS thread_id, + p.post_title AS plugin_title, p.post_name AS plugin_slug, + pm.meta_value AS plugin_version FROM {$wpdb->prefix}forum_notifications n - JOIN {$wpdb->prefix}forum_users u ON u.id = n.actor_id - LEFT JOIN {$wpdb->prefix}forum_threads t ON t.id = n.object_id + LEFT JOIN {$wpdb->prefix}forum_users u ON u.id = n.actor_id + LEFT JOIN {$wpdb->prefix}forum_threads t + ON t.id = n.object_id AND n.type != 'plugin_update' + LEFT JOIN {$wpdb->posts} p + ON p.ID = n.object_id AND n.type = 'plugin_update' AND p.post_type = 'mc_plugin' + LEFT JOIN {$wpdb->postmeta} pm + ON pm.post_id = p.ID AND pm.meta_key = '_vmcp_version' WHERE n.user_id = %d ORDER BY n.created_at DESC LIMIT %d", diff --git a/includes/class-forum-shortcodes.php b/includes/class-forum-shortcodes.php index a1f963b..8e9d716 100644 --- a/includes/class-forum-shortcodes.php +++ b/includes/class-forum-shortcodes.php @@ -932,11 +932,12 @@ class WBF_Shortcodes { $shop_tab_id = 'shop'; $allowed_tabs = [1,2,3,4]; if ($is_own && $shop_active) $allowed_tabs[] = $shop_tab_id; + if ($is_own) $allowed_tabs[] = 'plugins'; $active_tab = ctype_digit( (string) $ptab_raw ) ? (int) $ptab_raw : sanitize_key( $ptab_raw ); if (is_int($active_tab) && !in_array($active_tab, [1,2,3,4])) { $active_tab = $is_own ? 1 : 2; } - if (!is_int($active_tab) && $active_tab !== $shop_tab_id && $active_tab !== 'mc') { + if (!is_int($active_tab) && $active_tab !== $shop_tab_id && $active_tab !== 'mc' && $active_tab !== 'plugins') { $active_tab = $is_own ? 1 : 2; } // Tab 1, 3, 4, "shop" und String-Tabs nur für eigenes Profil (außer Tab 2 = Aktivität) @@ -951,207 +952,177 @@ class WBF_Shortcodes { /Profil -