1 Admin Guide
stak administrator edited this page 2026-09-10 11:43:10 +00:00

Admin Guide

This page describes the user-management features available to accounts with the admin role.

Accessing user management

Once logged in as an administrator, a "User management" link appears in the navigation, pointing to /admin/users. This page is only reachable by the admin role (see Roles and Routing).

User list (/admin/users)

Shows every registered user with:

  • Username
  • Email
  • Role (human-readable label from config/roles.php)
  • Registration date
  • Actions: Edit, and Delete (hidden for your own account — you cannot delete yourself)

Creating a user (/admin/users/new)

A form to create an account directly, without the person going through /register themselves. Fields:

  • Username (must be unique)
  • Email (optional)
  • Password (minimum 8 characters)
  • Role (any of the roles in config/roles.php, including admin)

Unlike self-registration, an admin-created account can be given any role immediately — it doesn't have to start as pending.

Editing a user (/admin/users/edit?id=...)

Lets you change:

  • Email
  • Role
  • Password (optional — leave the field empty to keep the existing password unchanged)

This is the normal way to approve a pending registration: open the user, change the role to role1/role2/role3/admin, and save.

Deleting a user (/admin/users/delete?id=...)

Shows a confirmation page before permanently deleting the account. You cannot delete your own account through this page (to avoid accidentally locking yourself out of the admin area).

Approving new registrations

  1. A new user signs up via /register and receives the pending role automatically.
  2. They can log in right away, but /dashboard only shows a message that their account is awaiting approval — no other protected page is accessible to pending users.
  3. An administrator opens /admin/users, finds the account, clicks Edit, and assigns a proper role.
  4. The user now has access according to their new role the next time they load a page (role checks read from the session, which is set at login — see the note below).

Note: role changes take effect the next time the affected user logs in, because the role is cached in their session at login time ($_SESSION['role'], set in attemptLogin() in app/auth.php). If you need role changes to apply immediately without a re-login, you'd need to re-check the role against the database on every request instead of relying on the session value.