Add menu enable toggle, user status, and mobile/UI polish
- Admin menu page: mobile item cards now put Actions in the top-right
corner next to Status, matching the desktop row layout instead of
stacking at the bottom; same treatment applied to announcements and
users for consistency across all three admin lists
- Center button label text everywhere via .btn { justify-content: center }
instead of one-off overrides
- Add a Disable/Enable Menu toggle to the admin menu toolbar; the public
menu page shows its existing "menu being updated" message while disabled
- Add an Enabled/Disabled status to user accounts, with its own toggle
badge, guardrails against disabling your own account or the last
enabled account, and an immediate session kick for anyone disabled
mid-session
- Fix the announcement banner / hero tagline "·" separators to hide only
when their neighboring text actually wraps onto a different line,
instead of a fixed breakpoint or always-on dot
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eab20899de
commit
cd4c6c1969
13 files changed
+405
-50
No files matched your search
+13
-2
@@ -13,13 +13,13 @@ require_once __DIR__ . '/db.php';
|
||||
|
||||
function get_all_users(): array {
|
||||
$pdo = get_db();
|
||||
$stmt = $pdo->query("SELECT id, username, role, created_at FROM users ORDER BY username ASC");
|
||||
$stmt = $pdo->query("SELECT id, username, role, is_enabled, created_at FROM users ORDER BY username ASC");
|
||||
return $stmt->fetchAll() ?: [];
|
||||
}
|
||||
|
||||
function get_user_by_id(int $id): ?array {
|
||||
$pdo = get_db();
|
||||
$stmt = $pdo->prepare("SELECT id, username, role, created_at FROM users WHERE id = ?");
|
||||
$stmt = $pdo->prepare("SELECT id, username, role, is_enabled, created_at FROM users WHERE id = ?");
|
||||
$stmt->execute([$id]);
|
||||
$res = $stmt->fetch();
|
||||
return $res ?: null;
|
||||
@@ -30,6 +30,17 @@ function count_users(): int {
|
||||
return (int) $pdo->query("SELECT COUNT(*) FROM users")->fetchColumn();
|
||||
}
|
||||
|
||||
function count_enabled_users(): int {
|
||||
$pdo = get_db();
|
||||
return (int) $pdo->query("SELECT COUNT(*) FROM users WHERE is_enabled = 1")->fetchColumn();
|
||||
}
|
||||
|
||||
function toggle_user_enabled(int $id): bool {
|
||||
$pdo = get_db();
|
||||
$stmt = $pdo->prepare("UPDATE users SET is_enabled = CASE WHEN is_enabled = 1 THEN 0 ELSE 1 END WHERE id = ?");
|
||||
return $stmt->execute([$id]);
|
||||
}
|
||||
|
||||
function username_exists(string $username, ?int $excludeId = null): bool {
|
||||
$pdo = get_db();
|
||||
if ($excludeId !== null) {
|
||||
|
||||
Reference in new issue
Block a user