This commit is contained in:
@@ -9,14 +9,12 @@ if ($isLoggedIn) {
|
||||
try {
|
||||
$pdo = $app->pdo();
|
||||
if ($pdo) {
|
||||
$stmt = $pdo->prepare('SELECT display_name, first_name FROM user_profiles WHERE user_id = :id LIMIT 1');
|
||||
$profileSettings = new \App\ProfileSettings($pdo);
|
||||
$profileSettings->ensureSchema();
|
||||
$stmt = $pdo->prepare('SELECT display_name, first_name, avatar_skin_tone, avatar_hair_style, avatar_hair_color, avatar_eye_color, avatar_beard_style, avatar_glasses_style, avatar_head_shape FROM user_profiles WHERE user_id = :id LIMIT 1');
|
||||
$stmt->execute(['id' => (int)$_SESSION['user_id']]);
|
||||
$profileRow = $stmt->fetch(PDO::FETCH_ASSOC) ?: [];
|
||||
$displayName = trim((string)($profileRow['display_name'] ?? '')) ?: trim((string)($profileRow['first_name'] ?? '')) ?: 'Profil';
|
||||
$firstChar = mb_substr($displayName, 0, 1);
|
||||
if ($firstChar !== '') {
|
||||
$profileInitial = mb_strtoupper($firstChar);
|
||||
}
|
||||
|
||||
$communityCfg = dirname(__DIR__, 2) . '/config/community.php';
|
||||
if (file_exists($communityCfg)) {
|
||||
@@ -50,7 +48,7 @@ if ($isLoggedIn) {
|
||||
<?php if ($isLoggedIn): ?>
|
||||
<div class="profile-menu" data-profile-menu>
|
||||
<button class="profile-menu__trigger" type="button" aria-haspopup="menu" aria-expanded="false" data-profile-menu-trigger>
|
||||
<span class="profile-menu__avatar" aria-hidden="true"><?= htmlspecialchars($profileInitial, ENT_QUOTES) ?></span>
|
||||
<span class="profile-menu__avatar" aria-hidden="true"><?= \App\Avatar::render($profileRow ?? [], $displayName, 'nav') ?></span>
|
||||
<span class="profile-menu__name"><?= htmlspecialchars($displayName, ENT_QUOTES) ?></span>
|
||||
</button>
|
||||
<div class="profile-menu__dropdown" role="menu">
|
||||
|
||||
Reference in New Issue
Block a user