Hi everyone!
Since I started working with Cobalt 8 I've noticed that I could not rate any of the records I created. It didn't even show the mouseover effect! I thought it was a bug with one of the javascripts but then when I created a test user I noticed that that user (that didn't create all of the records) could rate all of the records!
This made me check out how this is decided and didn't see anything in administration on either Content Type Edit or Section Edit. I managed to track it down to the file "rating.php" in "joomla/components/com_cobalt/library/php/helpers" where I found the function "canRate".
public static function canRate($type, $user_id, $id, $accessLevel = 1, $index = 0)
{
$user = JFactory::getUser();
if($accessLevel == -1)
{
if(!$user->get('id') || !$user_id)
{
return FALSE;
}
if($user_id != $user->get('id'))
{
return FALSE;
}
}
else
{
if(!in_array($accessLevel, $user->getAuthorisedViewLevels()))
{
return FALSE;
}
if($user_id == $user->get('id') && $user->get('id'))
{
return FALSE;
}
if($user->get('id') && JFactory::getApplication()->input->cookie->get("{$type}_rate_{$id}_{$index}", 0, 'INT'))
{
return FALSE;
}
$ses = JFactory::getSession();
if($ses->get("{$type}_rate_{$id}_{$index}"))
{
return FALSE;
}
}
return TRUE;
}
To my surprise I found that there's a rule that user can not vote for their own content and it's not even conditional with a parameter yes/no:
if($user_id == $user->get('id') && $user->get('id'))
{
return FALSE;
}
Now, I decided to comment out this code, and now as the user that created those records I can see the mouseover effect but when I click the rating it does not record. Is there anything I'm missing here? Is there another check somewhere that I'm not finding? Or am I being stupid and can this be changed in the administration section anyway??
Thanks ahead!
JB
Hi everyone!
Since I started working with Cobalt 8 I've noticed that I could not rate any of the records I created. It didn't even show the mouseover effect! I thought it was a bug with one of the javascripts but then when I created a test user I noticed that that user (that didn't create all of the records) could rate all of the records!
This made me check out how this is decided and didn't see anything in administration on either Content Type Edit or Section Edit. I managed to track it down to the file "rating.php" in "joomla/components/com_cobalt/library/php/helpers" where I found the function "canRate".
To my surprise I found that there's a rule that user can not vote for their own content and it's not even conditional with a parameter yes/no:
Now, I decided to comment out this code, and now as the user that created those records I can see the mouseover effect but when I click the rating it does not record. Is there anything I'm missing here? Is there another check somewhere that I'm not finding? Or am I being stupid and can this be changed in the administration section anyway??
Thanks ahead!
JB