Show marketing opt-in status in admin users overview

Adds a Marketing column to the admin users table and a total opt-in
count in the header, so admins can see who signed up for updates on
future projects.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Frank
2026-07-04 20:48:48 +02:00
co-authored by Claude Sonnet 5
parent ec34a1ddb9
commit 7dbb738da8
2 changed files with 14 additions and 3 deletions
@@ -22,8 +22,11 @@ final class GameAdminUserController extends AbstractController
#[Route('', name: 'game_admin_users', methods: ['GET'])]
public function index(UserRepository $userRepository): Response
{
$users = $userRepository->findBy([], ['id' => 'ASC']);
return $this->render('game/admin/users/index.html.twig', [
'users' => $userRepository->findBy([], ['id' => 'ASC']),
'users' => $users,
'marketingOptInCount' => count(array_filter($users, static fn (User $user) => $user->isMarketingOptIn())),
]);
}
+10 -2
View File
@@ -5,7 +5,7 @@
{% block admin_body %}
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem;">
<h1 style="margin: 0; font-size: 1.5rem; color: #0f172a;">Users</h1>
<span style="color: #64748b; font-size: 0.9rem;">{{ users|length }} total</span>
<span style="color: #64748b; font-size: 0.9rem;">{{ users|length }} total &middot; {{ marketingOptInCount }} opted in to marketing</span>
</div>
<div style="background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.07); overflow: hidden;">
@@ -17,6 +17,7 @@
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Email</th>
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Roles</th>
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Verified</th>
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Marketing</th>
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Actions</th>
</tr>
</thead>
@@ -49,6 +50,13 @@
<span style="color: #dc2626;">✗ No</span>
{% endif %}
</td>
<td style="padding: 0.75rem 1rem;">
{% if user.marketingOptIn %}
<span style="color: #16a34a; font-weight: 500;">✓ Yes</span>
{% else %}
<span style="color: #dc2626;">✗ No</span>
{% endif %}
</td>
<td style="padding: 0.75rem 1rem;">
<a href="{{ path('game_admin_user_edit', {id: user.id}) }}" style="
color: #3b82f6;
@@ -74,7 +82,7 @@
</tr>
{% else %}
<tr>
<td colspan="6" style="padding: 2rem; text-align: center; color: #94a3b8;">No users found.</td>
<td colspan="7" style="padding: 2rem; text-align: center; color: #94a3b8;">No users found.</td>
</tr>
{% endfor %}
</tbody>