I am developing a custom component and when I try to call my view I am receiving this error. The error occurs at: .\components\com_engineering\views\commentform\tmpl\default.php:24
Here is line 23 and 24
$user = JFactory::getUser();
$canEdit = EngineeringHelpersEngineering::canUserEdit($this->item, $user);
It was my understanding by using JLoader::register that Joomla would automatically load the helper when the class is needed. Either my understanding is incorrect or I am doing something wrong.
The following is what I am trying to do.
site/helpers/engineering.php
defined('_JEXEC') or die;
JLoader::register('EngineeringHelper', JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_engineering' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'engineering.php');
/**
* Class EngineeringFrontendHelper
*
* @since 1.6
*/
class EngineeringHelpersEngineering
{
public static function canUserEdit($item)
{
$permission = false;
$user = JFactory::getUser();
if ($user->authorise('core.edit', 'com_engineering'))
{
$permission = true;
}
else
{
if (isset($item->created_by))
{
if ($user->authorise('core.edit.own', 'com_engineering') && $item->created_by == $user->id)
{
$permission = true;
}
}
else
{
$permission = true;
}
}
return $permission;
}
// other classes
}
Thanks for any help!