No Code Attached Yet
avatar fusedNL
fusedNL
29 Oct 2024
  1. Create an article
  2. Under publishing put a different name for Author alias
  3. Load the article on the front end

Input:

Image

Output:
Image

Desired output:
Name should be the created by alias

avatar fusedNL fusedNL - open - 29 Oct 2024
avatar joomla-cms-bot joomla-cms-bot - change - 29 Oct 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 29 Oct 2024
avatar fgsw
fgsw - comment - 30 Oct 2024

Can't confirm:

Image
Image

avatar fusedNL
fusedNL - comment - 30 Oct 2024

What could possibly be the issue here? I have loaded through a custom layout override the following code to debug.

<?php // Force the use of created_by_alias if it exists, or fallback to author $this->item->author = !empty($this->item->created_by_alias) ? $this->item->created_by_alias : $this->item->author; echo 'Debug Author Alias: ' . $this->item->author; ?>

Other steps I have tried are checking the database direct, clearing the cache, all to no resulkt.

avatar brianteeman
brianteeman - comment - 30 Oct 2024

Have a look t how core joomla does this. The code is in layouts\joomla\content\info_block\author.php

avatar fusedNL
fusedNL - comment - 30 Oct 2024

@brianteeman yes, that is where I copied the override from. It looks working there but just doesnt render the output the same way. So cannot find anything odd in the database or the core / overrides.

As a background it is a site migrated from J3 to J4. I added a new article into the system and it brings the same result. The alias is not loaded.

<?php

/**
 * @package     Joomla.Site
 * @subpackage  Layout
 *
 * @copyright   (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

?>
<dd class="createdby" itemprop="author" itemscope itemtype="https://schema.org/Person">
    <span class="icon-user icon-fw" aria-hidden="true"></span>
    <?php $author = ($displayData['item']->created_by_alias ?: $displayData['item']->author); ?>
    <?php $author = '<span itemprop="name">' . $author . '</span>'; ?>
    <?php if (!empty($displayData['item']->contact_link) && $displayData['params']->get('link_author') == true) : ?>
        <?php echo Text::sprintf('COM_CONTENT_WRITTEN_BY', HTMLHelper::_('link', $displayData['item']->contact_link, $author, ['itemprop' => 'url'])); ?>
    <?php else : ?>
        <?php echo Text::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
    <?php endif; ?>
</dd>
avatar brianteeman
brianteeman - comment - 30 Oct 2024

without seeing the rest of your template, overrides etc its not possible to comment further. Even with that information this is not the place to fix the code in your template.

avatar Quy Quy - change - 30 Oct 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-10-30 14:50:59
Closed_By Quy
avatar Quy Quy - close - 30 Oct 2024
avatar Quy
Quy - comment - 30 Oct 2024

Please submit to Joomla forum for support. https://forum.joomla.org/

avatar fusedNL
fusedNL - comment - 30 Oct 2024

@brianteeman agreed, even with any of the overrides disabled it still isnt working out of the box. Thought it might be a bug in the core hence my post here. I will check whether the current site template has issues.

Add a Comment

Login with GitHub to post a comment