注销后joomla重定向用户

时间:2014-09-23 06:56:29

标签: php joomla joomla3.0 logout

我想在注销后重定向用户,这是我的代码:

$app     = JFactory::getApplication();              
$user    = JFactory::getUser();
$user_id = $user->get('id'); 
$par     = array();
$par['return'] = urlencode(base64_encode('index.php?option=com_teaching&view=parents&layout=cpanel&Itemid=150'));

$app->logout($user_id,Array('return'=>$par['return']));

2 个答案:

答案 0 :(得分:2)

$user = JFactory::getUser();
$app = JFactory::getApplication();

$app->logout($user_id);    
$app->redirect(JURI::base().'index.php?option=com_teaching&view=parents&layout=cpanel&Itemid=150', $error, 'error' ); 

$app->redirect(JRoute::_('index.php?option=com_teaching&view=parents&layout=cpanel&Itemid=150', false));
退出后

答案 1 :(得分:2)

你应该使用 Joomla!身份验证插件,在该插件中,您可以在onUserAfterLogout事件中键入重定向代码。