LuminaWebsite/discord_unlink.php
Maaxxs fa05cf3ef0 Add profile pictures: Discord avatar or a letter placeholder
Adds a discord_avatar column (captured from Discord's OAuth /users/@me
response and stored alongside discord_id/discord_username) and a new
avatar_html() helper: it renders the linked Discord avatar when one is
set, otherwise a circular placeholder with the display name's first
letter on a color picked deterministically per user from a palette
tuned for the dark/gold Lumina theme. Shown on the Startseite hero for
logged-in members and next to "Angemeldet als" in the sidebar footer.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 07:12:45 +02:00

14 lines
422 B
PHP

<?php
require_once __DIR__ . '/includes/bootstrap.php';
require_login();
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
redirect('/dashboard.php');
}
verify_csrf();
$user = current_user();
db()->prepare('UPDATE users SET discord_id = NULL, discord_username = NULL, discord_avatar = NULL WHERE id = ?')->execute([$user['id']]);
set_flash('success', 'Discord-Verknüpfung wurde entfernt.');
redirect('/dashboard.php');