0

我创建了一个新模块,如下所示。

<?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 的转储。

我究竟做错了什么?

4

1 回答 1

0

您应该首先调用 parent::install(); 然后只有 registerHook 函数。

您可以随时在 Modules -> Positions 中检查模块是否挂在了正确的钩子上

于 2015-01-11T15:37:53.270 回答