You are not logged in.
Hello guys,
I need to create a simple plugin so when a ticket is created, I get its data and execute a PHP script.
I did this but it doesn't work.I just need to know the changes that should be done.
This is my Setup.php
<?php
/*
setup.php
*/
function plugin_init_MyPlugin()
{
global $PLUGIN_HOOKS;
$PLUGIN_HOOKS['item_add']['MyPlugin'] = 'plugin_item_add_MyPlugin';
$PLUGIN_HOOKS['csrf_compliant']['MyPlugin'] = true;
}
function plugin_version_MyPlugin()
{
return [ 'name' => 'MyPlugin',
'version' => '1.0',
'author' => 'laroussi_aziz',
'license' => 'GPLv2+',
'homepage' => '',
'requirements' => [
'glpi' => [
'min' => '9.3',
'dev' => true
]
]
];
}
function plugin_MyPlugin_install() { return true; }
function plugin_MyPlugin_check_prerequisites() { return true; }
function plugin_MyPlugin_check_config() { return true; }
?>
and this is the hook.php :
<?php
/* hook.php */
// After an item is added
function plugin_item_add_MyPlugin($data)
{
// My PHP script
}
This plugin seems to be so simple, but I didn't know how to pull it off because I'm new to PHP. So hope that someone can guide me through this I really appreciate it and I need this so much!
Last edited by aziz (2021-12-03 16:41:49)
Offline