v1.0.0.8
Publisium
- <?php
-
- declare(strict_types=1);
-
- if (!AuthorProfile::isEnabled()) {
- echo '<h1 class="dash-title">' . Icons::icon('user', 'icon icon-lg') . 'Artist</h1>';
- echo Auth::hasRoleAtLeast(Auth::ROLE_EDITOR_IN_CHIEF)
- ? '<p>Author pages are turned off. Turn them on in <a href="settings.php?tab=layout">Settings → Layout</a> (tick "Turn on author pages").</p>'
- : '<p>Author pages are turned off. An administrator can enable them in Settings → Layout.</p>';
- return;
- }
-
- if (!AuthorProfile::canHaveProfile()) {
- echo '<p>Author pages aren’t available for your role.</p>';
- return;
- }
-
- $profile = AuthorProfile::forAccount((int) $currentUser['id']);
- $wasPosted = $_SERVER['REQUEST_METHOD'] === 'POST' && ($_POST['action'] ?? '') === 'save_profile';
- $form = $wasPosted
- ? [
- 'headline' => (string) ($_POST['headline'] ?? ''),
- 'bio' => (string) ($_POST['bio'] ?? ''),
- 'website_url' => (string) ($_POST['website_url'] ?? ''),
- ]
- : AuthorProfile::formValues($profile);
- $publishDirectly = Auth::canPublishDirectly();
- $status = $profile['status'] ?? 'draft';
- $showSchemaType = SiteFront::settings()['seo_article_schema_enabled'] === '1';
- $schemaType = $wasPosted ? (string) ($_POST['schema_type'] ?? '') : (string) ($profile['schema_type'] ?? '');
- $schemaType = in_array($schemaType, AuthorProfile::SCHEMA_TYPES, true) ? $schemaType : 'Person';
-
- ?>
- <div class="dash-header-row">
- <h1 class="dash-title"><?= Icons::icon('user', 'icon icon-lg') ?>Artist</h1>
- <?php if ($profile && (int) $profile['is_public'] === 1): ?>
- <a href="<?= htmlspecialchars(SiteFront::authorUrl((string) $profile['slug']), ENT_QUOTES) ?>" class="dash-btn-small" target="_blank" rel="noopener noreferrer"><?= Icons::icon('eye', 'icon icon-sm') ?>View page</a>
- <?php endif; ?>
- </div>
-
- <div class="sidebar-box" style="max-width:720px;">
- <p style="margin-bottom:12px;">
- <?php if ($profile === null): ?>
- You have not created your author page yet. Fill in the form below to start.
- <?php else: ?>
- Status: <span class="status-pill status-<?= htmlspecialchars(AuthorProfile::statusClass($status)) ?>"><?= htmlspecialchars(AuthorProfile::statusLabel($status)) ?></span>
- <?php if ((int) $profile['is_public'] === 1 && $status !== 'approved'): ?>
- · the public page keeps showing the last approved version until your changes are approved.
- <?php endif; ?>
- <?php endif; ?>
- </p>
-
- <?php if ($status === 'rejected' && !empty($profile['rejection_reason'])): ?>
- <div class="dash-flash dash-flash-error">Sent back with a note: <?= htmlspecialchars($profile['rejection_reason']) ?></div>
- <?php endif; ?>
-
- <form method="post">
- <?= Csrf::field() ?>
- <input type="hidden" name="action" value="save_profile">
-
- <label>Headline (e.g. "Technology reporter")</label>
- <input type="text" name="headline" maxlength="<?= AuthorProfile::HEADLINE_MAX ?>" value="<?= htmlspecialchars($form['headline']) ?>">
-
- <label>Bio (up to <?= AuthorProfile::BIO_MAX ?> characters)</label>
- <textarea name="bio" rows="8" maxlength="<?= AuthorProfile::BIO_MAX ?>"><?= htmlspecialchars($form['bio']) ?></textarea>
-
- <label>Website (optional)</label>
- <input type="url" name="website_url" maxlength="<?= AuthorProfile::URL_MAX ?>" value="<?= htmlspecialchars($form['website_url']) ?>" placeholder="https://">
-
- <?php if ($showSchemaType): ?>
- <label>For search engines, this author is</label>
- <select name="schema_type">
- <option value="Person" <?= $schemaType === 'Person' ? 'selected' : '' ?>>A person (Person)</option>
- <option value="Organization" <?= $schemaType === 'Organization' ? 'selected' : '' ?>>An organization, e.g. an editorial team or agency (Organization)</option>
- </select>
- <p style="font-size:12px;color:var(--muted);margin-top:6px;">Shown to search engines with your articles. It changes right away, without review.</p>
- <?php endif; ?>
-
- <p style="font-size:12px;color:var(--muted);margin-top:10px;">Your profile photo is set by an administrator in Team.</p>
-
- <div class="publish-actions">
- <button type="submit" name="intent" value="draft" class="dash-btn"><?= Icons::icon('pages', 'icon icon-sm') ?>Save draft</button>
- <button type="submit" name="intent" value="submit" class="dash-btn dash-btn-primary"><?= Icons::icon('check', 'icon icon-sm') ?><?= $publishDirectly ? 'Publish' : 'Send for review' ?></button>
- </div>
- </form>
- </div>
-