ISPsystem.com Forums

ISPsystem.com Forums (http://forum.ispsystem.com//index.php)
-   General technical discussion (http://forum.ispsystem.com//forumdisplay.php?f=8)
-   -   ispmgr 5 business: event handler (http://forum.ispsystem.com//showthread.php?t=2418)

mduh 02-05-2015 02:49 PM

ispmgr 5 business: event handler
 
Hello,

I am trying to write event handler that will be executed after new user is added. I can not get it working, seems that handler is not registered.

Content of /usr/local/mgr5/etc/xml/ispmgr_mod_useradd.xml

Code:

<?xml version="1.0" encoding="UTF-8"?>
<mgrdata>
  <handler name="uh-useradd.php" type="cgi">
    <event after="yes">user.add</event>
  </handler>
</mgrdata>

Content of /usr/local/mgr5/addon/uh-useradd.php

Code:

#!/usr/bin/php-cgi
<?php
file_put_contents('/usr/local/mgr5/var/uh-ispmgr.log', "\n".date('Y-m-d H:i:s'), FILE_APPEND);

As you can see all the plugin do is just write log message. Right now I can not see any log entries, so it is not executed.

BTW: I used such an approach in version 4 of ispsystem products and there was no problem.

Thanks,
-Maciej

fly 02-05-2015 04:15 PM

Hello,

If you use Business version, you need to name xml file as ispmgrnode_mod_...

Please try to rename file and restart a control panel.

mduh 02-06-2015 05:50 PM

Hello,

Thank you for the answer. However I renamed the file to ispmgrnode_mod_useradd.xml and it still does not work. The handler is not executed.

Thanks,
-Maciej

fly 02-09-2015 02:57 PM

I have plugin works with next xml file:

# cat /usr/local/mgr5/etc/xml/ispmgr_mod_useradd.xml
<?xml version="1.0" encoding="UTF-8"?>
<mgrdata>
<handler name="uh-useradd.php" type="cgi">
<event name="user.add.finish" after="yes" />
</handler>
</mgrdata>

OR

# cat /usr/local/mgr5/etc/xml/ispmgrnode_mod_useradd.xml
<?xml version="1.0" encoding="UTF-8"?>
<mgrdata>
<handler name="uh-useradd.php" type="cgi">
<event name="user.edit" after="yes" />
</handler>
</mgrdata>

If you want to have plugin for ispmgrnode you need to add this file on a all nodes.

mduh 02-10-2015 10:24 PM

Seems the event format has changed from:

Code:

<event after="yes">user.add.finish</event>
to

Code:

<event name="user.add.finish" after="yes" />
It works now. Thanks a lot!

fly 02-11-2015 09:46 AM

I was glad to help you )


All times are GMT +2. The time now is 05:51 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2022, vBulletin Solutions, Inc.