WebOrbiton
v1.0.0.6

Publisium

19 lines · 617 B
  1. <?php
  2. ​
  3. declare(strict_types=1);
  4. ​
  5. if (!AuthorProfile::isEnabled() || !AuthorProfile::canHaveProfile()) {
  6. return ['Author pages aren’t available for your role.', 'error', false];
  7. }
  8. ​
  9. $intent = ($_POST['intent'] ?? '') === 'submit' ? 'submit' : 'draft';
  10. $accountId = (int) $currentUser['id'];
  11. ​
  12. [$message, $type] = AuthorProfile::save($accountId, (string) $currentUser['display_name'], $_POST, $intent, Auth::canPublishDirectly());
  13. ​
  14. if ($type === 'success') {
  15. ActivityLog::record($intent === 'submit' ? 'profile.submit' : 'profile.save', 'profile', $accountId);
  16. }
  17. ​
  18. return [$message, $type, $type === 'success'];
  19. ​