版本-Joomla 3.6.2
我的软件包包括一个管理组件,一个前端组件和一个模块。
我正在尝试在用户注销时运行一些php代码(http请求)。我对在哪里编写该代码感到困惑。我有几个问题-
是的,编写用户插件是您想要的,并且非常简单。以下是您开始使用的骨架:
<?xml version="1.0" encoding="utf-8"?> <extension version="3.0.0" type="plugin" group="user" method="upgrade"> <name>plg_user_yourplugin</name> <author>NeiL</author> <creationDate>Aug 2017</creationDate> <version>3.1.0</version> <description>Add a description</description> <files> <filename plugin="yourplugin">yourplugin.php</filename> </files> </extension>
<?php defined('_JEXEC') or die; class PlgUserYourplugin extends JPlugin { function onUserLogout($credentials, $options){ // call whatever php you like here... return true; } }
文档说onUserLogout应该返回一个布尔值,但是返回false似乎没有效果,用户仍然注销该用户。
如果该插件只能在前端运行,则需要进行处理。
创建文件后,可以使用发现-功能(扩展->管理->发现)来安装插件。请记住在安装后启用插件。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句