# Administrator & Editor Manual

## Roles

| Role | Capabilities |
|---|---|
| **Student** | Submit content, request airtime, use AI tools, like/comment/save content |
| **Editor** | All student capabilities + review/approve/reject content, manage broadcasts, approve/reject airtime requests |
| **Admin** | All editor capabilities + send push notifications, manage AI tool settings |

Role assignment requires direct database access: `UPDATE users SET role = 'editor' WHERE email = '...';`

---

## Editorial Review

### Review Queue (`editor/review-queue.php`)

All submitted content and podcasts in a single merged queue, oldest first. Click **Review →** to open the review screen.

### Reviewing articles / audio / video (`editor/review-item.php`)

Four actions:
- **Save Edits** — fix the content without changing status
- **Approve & Publish** — publishes immediately; content appears on the public site
- **Request Revision** — returns to student with a required note explaining what to change
- **Reject** — declines with a required note

For video posts the YouTube embed is shown inline. For audio reports a native player appears. All decisions are written to the audit log.

### Reviewing podcasts (`editor/review-podcast.php`)

Same four actions. An inline audio player lets you verify the external URL actually plays before approving. If the link appears broken, use Request Revision rather than Reject.

---

## Broadcast Management (`editor/manage-broadcasts.php`)

**Control tab:** Set the stream URL (must be `https://`), current presenter, and toggle on/off air. The listener counter resets to zero each time you go live. Going off air does not reset it.

**Schedule tab:** Add/edit/delete weekly programs (title, presenter, day, start time, end time). Appears on `content/radio.php`.

**Airtime Requests tab:** Student requests for broadcast slots, oldest first. Approve (optional note) or reject (required note). Students see the outcome on their My Requests page.

---

## Push Notifications (`admin/notifications.php`)

Requires VAPID keys in `config.php` and at least one subscriber.

| Type | Audience |
|---|---|
| Breaking News | All subscribers |
| New Podcast | All subscribers |
| Live Radio Started | All subscribers |
| General Announcement | All subscribers |
| Content Approved | Student subscribers only |

Expired subscriptions (browser revoked permission) are automatically cleaned up on each send.

---

## AI Tools Settings (`admin/ai-tools-settings.php`)

For each of the 7 tools: enable/disable, daily limit per user (1–100, resets at midnight), provider (Claude/OpenAI/Gemini). Usage stats (today and all-time per tool) appear at the top.

---

## Audit Log (`editor/audit-log.php`)

Every editorial and administrative action is logged here. Append-only — never edited or deleted. Use it to trace who approved or rejected any piece of content and when.

---

## phpMyAdmin tasks (no in-app UI)

```sql
-- Assign a role
UPDATE users SET role = 'editor' WHERE email = 'editor@example.com';

-- Suspend a user
UPDATE users SET status = 'suspended' WHERE email = 'student@example.com';

-- Hard-delete a comment (app default is soft-hide)
DELETE FROM comments WHERE id = 123;
```
