Link to Contestant
When contestants submit entries to a contest, NorrCompetition can display the author's name on the entry page and link it directly to their user profile.
⚙️ Configuration Prerequisites
Before links can appear on the frontend, ensure the relevant parameters are enabled in NorrCompetition:
Go to Administrator > Components > NorrCompetition > Options > Entries (or configure at individual contest level).
Set Show Contestant to Yes.
Set Link Contestant to Yes.
💻 Custom Plugin Implementation
If you use a custom member directory or third-party community extension, you can create a standard Joomla content plugin implementing SubscriberInterface and listening to ContentPrepareEvent.
The goal is to assign the target profile URL to $item->submitter_link.
Example Plugin Class (src/Extension/CustomProfileLink.php)
<?php
namespace MyCompany\Plugin\Content\CustomProfileLink\Extension;
\defined('_JEXEC') or die;
use Joomla\CMS\Event\Content\ContentPrepareEvent;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\Route;
use Joomla\Event\SubscriberInterface;
use Joomla\Registry\Registry;
final class CustomProfileLink extends CMSPlugin implements SubscriberInterface
{
/**
* Subscribes to Joomla content prepare events.
*
* @return array<string, string>
*/
public static function getSubscribedEvents(): array
{
return [
'onContentPrepare' => 'onContentPrepare',
];
}
/**
* Prepares contestant profile link for NorrCompetition entries.
*
* @param ContentPrepareEvent $event
* @return void
*/
public function onContentPrepare(ContentPrepareEvent $event): void
{
$context = $event->getContext();
$item = $event->getItem();
$params = $event->getParams();
// 1. Verify context
if ($context !== 'com_competition.participant') {
return;
}
// 2. Verify component parameters require submitter link
if (
!($params instanceof Registry)
|| !$params->get('participant_show_submitter', 0)
|| !$params->get('participant_link_submitter', 0)
) {
return;
}
// 3. Verify registered user ID is present
if (empty($item->userId) || (int) $item->userId === 0) {
return;
}
// 4. Assign the SEF profile URL
$item->submitter_link = Route::_('index.php?option=com_custommember&view=profile&id=' . (int) $item->userId);
}
}Last updated