Skip to content

Fix user list to display profile names with fallback - #162

Merged
itshypax merged 2 commits into
mainfrom
copilot/fix-user-list-name-display
Nov 16, 2025
Merged

Fix user list to display profile names with fallback#162
itshypax merged 2 commits into
mainfrom
copilot/fix-user-list-name-display

Conversation

Copilot AI commented Nov 14, 2025

Copy link
Copy Markdown
Contributor

User list was displaying outdated intra_users.fullname instead of profile-linked names from intra_mitarbeiter.

Changes

  • Updated query to LEFT JOIN intra_mitarbeiter on discord_id = discordtag
  • Use COALESCE(m.fullname, 'Kein Profil verbunden') to display profile name or fallback text
  • Added XSS protection via htmlspecialchars() on display output
// Before
$stmt = $pdo->prepare("SELECT * FROM intra_users");
// ...
echo "<td>" . $row['fullname'] . " (<strong>" . $row['username'] . "</strong>)</td>";

// After
$stmt = $pdo->prepare("SELECT u.id, u.username, u.created_at, u.role, u.full_admin, u.discord_id, 
    COALESCE(m.fullname, 'Kein Profil verbunden') as fullname 
    FROM intra_users u 
    LEFT JOIN intra_mitarbeiter m ON u.discord_id = m.discordtag");
// ...
echo "<td>" . htmlspecialchars($row['fullname']) . " (<strong>" . htmlspecialchars($row['username']) . "</strong>)</td>";

Aligns with pattern used in dokumente/schreiben/*.php and mitarbeiter/profile.php.

Original prompt

This section details on the original issue you should resolve

<issue_title>Benutzerliste zeigt falsche Namen an</issue_title>
<issue_description>/benutzer/list.php zeigt noch falsche Namen an.

Die veraltete Anzeige von vollständigen Namen (die neu geschrieben und überarbeitet wurde) fehlt in der Benutzerliste. Alternativ kann auch auf einen Beispieltext wie "Kein Profil verbunden" ausgewichen werden. Die Anzeige des alten Vollnamens ist nicht mehr aktuell.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix user list showing incorrect names Fix user list to display profile names with fallback Nov 14, 2025
Copilot AI requested a review from itshypax November 14, 2025 16:43
@itshypax
itshypax marked this pull request as ready for review November 16, 2025 07:51
@itshypax
itshypax merged commit 2e7fd20 into main Nov 16, 2025
2 checks passed
@itshypax
itshypax deleted the copilot/fix-user-list-name-display branch November 16, 2025 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Benutzerliste zeigt falsche Namen an

2 participants