From 764f760b61efafca4cc45451e8b5b3dcae7155a6 Mon Sep 17 00:00:00 2001 From: Git Manager GUI Date: Sun, 5 Apr 2026 12:40:36 +0200 Subject: [PATCH] Upload folder via GUI - includes --- includes/class-forum-ajax.php | 9 + includes/class-forum-db.php | 13 +- includes/class-forum-shortcodes.php | 680 +++++++++++++--------------- includes/forum-plugin-watch.php | 269 +++++++++++ 4 files changed, 607 insertions(+), 364 deletions(-) create mode 100644 includes/forum-plugin-watch.php 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 -
+ +
- - + - -
- - - role) >= 0): ?> -
- - Nachricht senden - - id, $profile->id); ?> - - -
- - - - - - + +
@@ -1799,125 +1770,114 @@ class WBF_Shortcodes { Neue Integrationen: einfach weiteres .wbf-connection-card-Block via apply_filters('wbf_profile_connections', ...) hinzufügen. ══════════════════════════════════════════════════ --> + + + id) : ''; + $mc_name = $mc_enabled ? WBF_MC_Bridge::get_mc_name($profile->id) : ''; + $mc_linked = !empty($mc_uuid); + // ── Discord ── + $discord_meta = WBF_DB::get_user_meta($profile->id); + $discord_current = trim($discord_meta['discord_username'] ?? ''); + $discord_connected = $discord_current !== ''; + $s_cfg = wbf_get_settings(); + $discord_bot_configured = !empty(trim($s_cfg['discord_bot_token'] ?? '')); + ?>
Verbundene Dienste
-
+
- -
-
- -
-
- Gallerie Verbindung -
-
- + + +
+
+
+ +
+
+ Gallerie + Minecraft-Account verknüpfen um Bilder ohne Token hochzuladen +
+
- id ) : ''; - $mc_name = $mc_enabled ? WBF_MC_Bridge::get_mc_name( $profile->id ) : ''; - $mc_linked = ! empty( $mc_uuid ); - ?> -
-
- -
-
- Minecraft InGame Verbindung - - - Nicht konfiguriert - - - - Verbunden - - - - Nicht verbunden - - -
-
- -

- - Die Minecraft Bridge ist noch nicht eingerichtet. - Ein Admin muss sie zuerst in den Forum-Einstellungen aktivieren. -

- -
- -
-
- -
+ +
+
+
+
-

- - Du erhältst Ingame-Benachrichtigungen bei Antworten, Erwähnungen und PNs. -

-
- - -

- Verknüpfe deinen Minecraft-Account für Ingame-Benachrichtigungen - bei neuen Antworten, Erwähnungen und Privatnachrichten. -

-

- - Schritt 1: Token generieren  →  - Schritt 2: /forumlink <token> ingame eingeben -

- +
diff --git a/includes/forum-plugin-watch.php b/includes/forum-plugin-watch.php new file mode 100644 index 0000000..e4be357 --- /dev/null +++ b/includes/forum-plugin-watch.php @@ -0,0 +1,269 @@ +id, 100 ) + : []; + $archive_url = get_post_type_archive_link('mc_plugin') ?: home_url('/mc-plugins/'); + // Nonce für vmcp_toggle_watch (aus MC-Plugin) + $vmcp_nonce = wp_create_nonce('vmcp_nonce'); + $ajax_url = admin_url('admin-ajax.php'); + ?> +
+
+ Beobachtete Plugins + +
+ + +
+ +

Du beobachtest noch kein Plugin.

+ + Plugins entdecken → + +
+ +
    + plugin_id ); + $thumb = get_the_post_thumbnail_url( $w->plugin_id, 'thumbnail' ); + $version = get_post_meta( $w->plugin_id, '_vmcp_version', true ); + $premium = get_post_meta( $w->plugin_id, '_vmcp_premium', true ) === '1'; + $initial = mb_strtoupper( mb_substr( $w->post_title, 0, 1 ) ); + $since = human_time_diff( strtotime($w->created_at), current_time('timestamp') ); + ?> +
  • + + + + +
    + +
    +
    + + post_title); ?> + +
    + + v + + + ⭐ Premium + + Seit +
    +
    + +
  • + +
+ +
+ + +
+
+ Wunschliste + 0 +
+
+
+ + Lade Wunschliste… +
+
+
+ + + + + type !== 'plugin_update' ) return $html; + $plugin_id = (int) $notif->object_id; + $post = get_post( $plugin_id ); + if ( ! $post ) return $html; + $title = esc_html( $post->post_title ); + $link = esc_url( get_permalink( $plugin_id ) ); + $version = esc_html( get_post_meta( $plugin_id, '_vmcp_version', true ) ); + $thumb = get_the_post_thumbnail_url( $plugin_id, 'thumbnail' ); + $time_ago = human_time_diff( strtotime($notif->created_at), current_time('timestamp') ); + ob_start(); ?> +
+
+ + + + + +
+
+ + + wurde aktualisiertv'.$version.'' : ''; ?>. + + vor +
+
+