v2.0.0.0
Publisium
- <?php
-
- declare(strict_types=1);
-
- if (!AuthorProfile::isEnabled()) {
- echo '<p>Author pages are turned off. An administrator can enable them in Settings → Layout.</p>';
- return;
- }
-
- if (!Auth::canModerate()) {
- echo '<p>Only editors can review author pages.</p>';
- return;
- }
-
- $statement = Database::site()->query(
- "SELECT p.*, t.display_name, t.avatar_path
- FROM author_profiles p
- JOIN team_accounts t ON t.id = p.account_id
- WHERE p.status = 'pending'
- ORDER BY p.updated_at ASC"
- );
- $pendingProfiles = $statement->fetchAll();
- $wasPosted = $_SERVER['REQUEST_METHOD'] === 'POST' && ($_POST['action'] ?? '') === 'review_profile';
-
- ?>
- <h1 class="dash-title"><?= Icons::icon('user', 'icon icon-lg') ?>Artist reviews</h1>
-
- <?php if (empty($pendingProfiles)): ?>
- <p>No author pages are waiting for review.</p>
- <?php endif; ?>
-
- <?php foreach ($pendingProfiles as $pending): ?>
- <?php
- $accountId = (int) $pending['account_id'];
- $isPostedOne = $wasPosted && (int) ($_POST['account_id'] ?? 0) === $accountId;
- $form = $isPostedOne
- ? [
- 'headline' => (string) ($_POST['headline'] ?? ''),
- 'bio' => (string) ($_POST['bio'] ?? ''),
- 'website_url' => (string) ($_POST['website_url'] ?? ''),
- ]
- : AuthorProfile::formValues($pending);
- ?>
- <div class="sidebar-box" style="max-width:720px;margin-bottom:20px;">
- <p style="display:flex;align-items:center;gap:10px;margin-bottom:12px;">
- <?= Avatar::html($pending, 'dash-user-avatar') ?>
- <strong><?= htmlspecialchars($pending['display_name']) ?></strong>
- <span class="status-pill status-pending_review"><?= htmlspecialchars(AuthorProfile::statusLabel('pending')) ?></span>
- </p>
-
- <?php if ((int) $pending['is_public'] === 1): ?>
- <details style="margin-bottom:12px;">
- <summary>What’s live right now</summary>
- <p><strong><?= htmlspecialchars((string) $pending['headline']) ?></strong></p>
- <p><?= nl2br(htmlspecialchars((string) $pending['bio'])) ?></p>
- </details>
- <?php endif; ?>
-
- <form method="post">
- <?= Csrf::field() ?>
- <input type="hidden" name="action" value="review_profile">
- <input type="hidden" name="account_id" value="<?= $accountId ?>">
-
- <label>Headline</label>
- <input type="text" name="headline" maxlength="<?= AuthorProfile::HEADLINE_MAX ?>" value="<?= htmlspecialchars($form['headline']) ?>">
-
- <label>Bio (you can edit it before approving)</label>
- <textarea name="bio" rows="8" maxlength="<?= AuthorProfile::BIO_MAX ?>"><?= htmlspecialchars($form['bio']) ?></textarea>
-
- <label>Website</label>
- <input type="url" name="website_url" maxlength="<?= AuthorProfile::URL_MAX ?>" value="<?= htmlspecialchars($form['website_url']) ?>" placeholder="https://">
-
- <label>Note for the author (only if you send it back)</label>
- <input type="text" name="rejection_reason" maxlength="<?= AuthorProfile::REASON_MAX ?>" value="">
-
- <div class="publish-actions">
- <button type="submit" name="decision" value="approve" class="dash-btn dash-btn-primary"><?= Icons::icon('check', 'icon icon-sm') ?>Approve and publish</button>
- <button type="submit" name="decision" value="reject" class="dash-btn dash-btn-danger"><?= Icons::icon('x', 'icon icon-sm') ?>Send back</button>
- </div>
- </form>
- </div>
- <?php endforeach; ?>
-