我创建了一个新模块,如下所示。
<?php
class dpmessages extends Module
{
function __construct()
{
$this->name = 'dpmessages';
$this->tab = 'administration';
$this->version = '0.1';
parent::__construct();
$this->displayName = $this->l('DP messages');
$this->description = $this->l('Envoyer messages');
parent::__construct();
/* The parent construct is required for translations */
}
function install()
{
$this->registerHook('actionAuthentication');
if (parent::install() == FALSE
)
return FALSE;
return TRUE;
}
function uninstall()
{
if (!parent::uninstall())
return false;
return true;
}
public function hookActionAuthentication($params) {
echo "<pre>".print_r($params)."</pre>";die();
}
}
我在它上面注册了一个actionAuthentication钩子,我假设它会在每次新用户登录时触发hookActionAuthentication的代码,但它并没有触发。
我看不到$params的垃圾堆。
我做错了什么?
发布于 2015-01-11 23:37:53
您应该首先调用parent::install();,然后再调用registerHook函数。
您始终可以检查模块是否挂接到模块->位置中的右钩子上
https://stackoverflow.com/questions/21521965
复制相似问题