Keyword

K2 "Registered" items produced 403 error! Yuck!

More
14 years 7 months ago #71242 by wayne
K2 uses:
//Access check
$user = & JFactory::getUser();
if ($category->access > $user->get('aid', 0)) {
JError::raiseError( 403, JText::_("ALERTNOTAUTH") );
}
if (!$category->published || $category->trash) {
JError::raiseError( 404, JText::_("Category not found") );
}

Joomla 1.5 uses:

// Check to see if the user has access to view the full article
$aid = $user->get('aid');

if ($article->access <= $aid) {
$article->readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid));;
} else {
if ( ! $aid )
{
// Redirect to login
$uri = JFactory::getURI();
$return = $uri->toString();

$url = 'index.php?option=com_user&view=login';
$url .= '&return='.base64_encode($return);;

//$url = JRoute::_($url, false);
$mainframe->redirect($url, JText::_('You must login first') );
}
else{
JError::raiseWarning( 403, JText::_('ALERTNOTAUTH') );
return;
}
}

I am using a hack a custom error.php
if ($this->error->code == '403') {
$uri = JFactory::getURI();
$return = $uri->toString();

$url = 'index.php?option=com_user&view=login';
$url .= '&return='.base64_encode($return);

header('Location:'.$url); die();
}

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum