首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >模块中的Prestashop挂钩[Prestashop 1.5.6.2]

模块中的Prestashop挂钩[Prestashop 1.5.6.2]
EN

Stack Overflow用户
提问于 2014-02-03 15:37:06
回答 1查看 560关注 0票数 0

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

代码语言:javascript
运行
复制
<?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的垃圾堆。

我做错了什么?

EN

回答 1

Stack Overflow用户

发布于 2015-01-11 23:37:53

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

您始终可以检查模块是否挂接到模块->位置中的右钩子上

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21521965

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档