Try using this:
Code:
JError::raiseError( 'SOME_ERROR_CODE', JText::_( 'Custom Error' ));
If that doesn't work, you could alter the logout function for com_user in the controller file:
/components/com_user/controller.php(find the logout function, and change it to this):
Code:
function logout()
{
global $mainframe;
//preform the logout action
$error = $mainframe->logout();
if(!JError::isError($error))
{
if ($return = JRequest::getVar('return', '', 'method', 'base64')) {
$return = base64_decode($return);
if (!JURI::isInternal($return)) {
$return = '';
}
}
// Redirect if the return url is not registration or login
if ( $return && !( strpos( $return, 'com_user' )) ) {
$mainframe->redirect( $return );
}
} else {
JError::raiseError( 'CUSTOM_ERROR_CODE', JText::_( 'Custom Error' ));
parent::display();
}
}
or...
Code:
function logout()
{
global $mainframe;
//preform the logout action
$error = $mainframe->logout();
if(!JError::isError($error))
{
if ($return = JRequest::getVar('return', '', 'method', 'base64')) {
$return = base64_decode($return);
if (!JURI::isInternal($return)) {
$return = '';
}
}
// Redirect if the return url is not registration or login
if ( $return && !( strpos( $return, 'com_user' )) ) {
$mainframe->redirect( $return );
}
} else {
$this->setredirect('index.php?option=com_user',JText::_('Custom Code'));
}
}
Do any of these work for you?