Links

Link to contestant

To make a link to a user who has submitted an entry for contest, you need to create a content plugin for onContentPrepare event.
In entry layout options the parameter Contestant should be enabled, as well as Link Contestant.
The idea is to set submitter_link property for entry object. Here is an example of onContentPrepare code:
/**
* Retrieves the link for contestant.
*
* @param string $context The context of the content being passed to the plugin.
* @param mixed &$item An entry object.
* @param object $params Component parameters.
* @param integer $page Optional page number. Unused. Defaults to zero.
*
* @return boolean
*/
public function onContentPrepare($context, &$item, $params, $page = 0)
{
// Check for valid context
if ($context != 'com_competition.participant')
{
return true;
}
​
// Return if we don't have valid params or don't show/link to the contestant
if (!($params instanceof Joomla\Registry\Registry)
|| !$params->get('participant_show_submitter')
|| !$params->get('participant_link_submitter'))
{
return true;
}
​
// Return if we don't have a valid submitter id
if (!isset($item->userId) || !(int) $item->userId)
{
return true;
}
​
// Set the link to submitter
$item->submitter_link = JRoute::_('index.php?option=com_somecomponent&profile=' . $item->userId);
​
return true;
}