2012-03-10 135 views
1

Joomla 1.7.2:我担心我会让它变得比它需要的更困难。这就是我需要做的:Joomla:强制登录用户出局

if(!$this->userInUserGroup()){ 
    // Log the user out 
    // Redirect to home page displaying system message 
    $this->setRedirect('/', 'You must be in Usergroup XYZ to log in to this website.', 'error'); 
    $this->redirect(); 
} 

,因为我不能注销用户这是行不通的。 session_destroy()不起作用,因为它消除了用$this->setRedirect()调用的错误消息数据。

我想过修改login模块,但我宁愿不修改核心,如果我可以帮助它。这种方法将被舒适地限制在我的课程ComponentController

感谢您提供任何帮助!

回答

3

ShaneC你可以使用大型机的注销方法。

global $mainframe; 

$mainframe->logout(); 

$mainframe = JFactory::getApplication(); 
$mainframe->logout(); 
+0

精彩!谢谢您的回复。 – ShaneC 2012-03-10 03:48:34

+0

不客气! =) – Nathan 2012-03-10 03:51:00