run php code on user logout in joomla 3 -


version - joomla 3.6.2

my package includes 1 admin component, 1 frontend component , 1 module.

i trying run php code(http request) on user logout. confused write code. have few questions -

yes, writing user plugin want, , pretty simple. below skeleton start with:

  • make new folder in installation, ex /plugin/user/yourplugin
  • add xml-file: yourplugin.xml following content:

<?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 description</description> <files> <filename plugin="yourplugin">yourplugin.php</filename> </files> </extension>

  • and php-file like

<?php defined('_jexec') or die; class plguseryourplugin extends jplugin { function onuserlogout($credentials, $options){ // call whatever php here... return true; } }

the docs onuserlogout should return boolean, returning false not seem have effect, user still logs user out.

if plugin should run on frontend, need handle this.

you can use discover - functionality (extensions->manage->discover) install plugin after create files. remember enable plugin after installing.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -