2016-11-22 58 views
1

我已经成功实现了onUserAuthenticate事件来实现我的自定义身份验证API在Joomla!我正在努力的网站。Joomla! 3.xx * onUserLogout *事件不起作用

现在我想要在onUserLogout事件上运行一些自定义代码。

我已将以下代码添加到自定义身份验证插件文件。 但是这种方法没有被触发/调用,而前一个(onUserAuthenticate)工作得很好。

/** 
* Method to handle the SSO logout 
* 
* @param array $user  Holds the user data. 
* @param array $options Array holding options (client, ...). 
* 
* @return boolean Always returns true. 
* 
* @since 1.6 
*/ 
public function onUserLogout($user, $options = array()) { 
    if (JFactory::getApplication()->isSite()) { 
     // Set the cookie to expired date. 
     setcookie('customAuth', '123', time() - (60 * 60 * 24 * 365), '/', '.customdomain.org'); 
    } 
    return true; 
} 

回答

1

好吧,我弄错了。

所以我在处理onUserAuthenticate的同一个插件文件中加入了上述方法。

对于Joomla!登录是一个单独的过程,它有各自的事件,如onUserAuthenticate

但似乎事件onUserLogout必须在插件typeuser

因此,我在user插件类型目录内创建了一个单独的插件,并安装了它并启用了它....并且瞧!有效。

这让我挠了一下头。