You can try this:
I am using Joomla v2.5.6 and K2 v2.5.7
If your K2 category is set to registered and you have assigned a menu item to the registered category then you will receive "403 - You are not authorized to view this resource"
To resolve this issue we need to manually change the code on the backend.
1) Go To [SITE ROOT]\components\com_k2\views\itemlist\view.html.php
2) Find the code "JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));" which is contained in
$user = &JFactory::getUser();
if(K2_JVERSION=='16'){
if (!in_array($category->access, $user->authorisedLevels())) {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
$languageFilter = $mainframe->getLanguageFilter();
$languageTag = JFactory::getLanguage()->getTag();
if($languageFilter && $category->language!=$languageTag && $category->language!='*') {
return;
}
}
3) Replace the code "JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));" with:
if ($this->error->code = '403') {
$return = $_SERVER;
$return = base64_encode($return);
$uri = JRoute::_("index.php?option=com_users&view=login&return=$return");
header('Location:'.$uri); die();
}
4) Final code should look like:
$user = &JFactory::getUser();
if(K2_JVERSION=='16'){
if (!in_array($category->access, $user->authorisedLevels())) {
/*JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));*/
if ($this->error->code = '403') {
$return = $_SERVER;
$return = base64_encode($return);
$uri = JRoute::_("index.php?option=com_users&view=login&return=$return");
header('Location:'.$uri); die();
}
}
$languageFilter = $mainframe->getLanguageFilter();
$languageTag = JFactory::getLanguage()->getTag();
if($languageFilter && $category->language!=$languageTag && $category->language!='*') {
return;
}
}
5) This should resolve the issue.
6) You can do the same for [SITE ROOT]\components\com_k2\views\item\view.html.php
7) Find the code "JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));" which is contained in
if(K2_JVERSION=='16'){
if (!in_array($item->access, $user->authorisedLevels()) || !in_array($item->category->access, $user->authorisedLevels())) {
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
}
8) Replace the code "JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));" with:
if ($this->error->code = '403') {
$return = $_SERVER;
$return = base64_encode($return);
$uri = JRoute::_("index.php?option=com_users&view=login&return=$return");
header('Location:'.$uri); die();
}
9) Final code should look like:
if(K2_JVERSION=='16'){
if (!in_array($item->access, $user->authorisedLevels()) || !in_array($item->category->access, $user->authorisedLevels())) {
/*JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));*/
if ($this->error->code = '403') {
$return = $_SERVER;
$return = base64_encode($return);
$uri = JRoute::_("index.php?option=com_users&view=login&return=$return");
header('Location:'.$uri); die();
}
}
}