PHP Joomla! 6 Joomla! 5 Template Override Intermediate

Load Author Custom Fields (com_users.user) for an Author Bio Box

Loads the article author via UserFactoryInterface and reads their com_users.user Custom Fields such as role, bio and avatar.

Updated on 24 November 2026 30 copies 116 views
templates/seu_template/html/com_content/article/default.php
<?php

declare(strict_types=1);

use Joomla\CMS\Factory;
use Joomla\CMS\User\UserFactoryInterface;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;

$author     = Factory::getContainer()->get(UserFactoryInterface::class)->loadUserById((int) $this->item->created_by);
$userFields = FieldsHelper::getFields('com_users.user', $author, true);
$profile    = [];

foreach ($userFields as $field) {
    $profile[$field->name] = $field->value;
}

echo htmlspecialchars($author->name, ENT_QUOTES, 'UTF-8');
echo $profile['biografia'] ?? '';
Uses DI UserFactoryInterface instead of deprecated Factory::getUser($id).

Technical explanation and best practices

Ideal for building native E-E-A-T author bio cards inside article overrides using zero third-party extensions.

Direct Engineering

Have a Joomla project or technical challenge in mind?

From architectural diagnosis to production deployment, directly with the engineer.