US: 1-941-4621-069
  
Cyprus: 3-572-2052-781

Go Back   ISPsystem.com Forums > ISPmanager > General technical discussion


Reply
 
Thread Tools
Old 02-05-2015, 02:49 PM   #1
Junior Member
 
Join Date: Jan 2015
Posts: 28
mduh is on a distinguished road
Default 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
mduh is offline   Reply With Quote
Old 02-05-2015, 04:15 PM   #2
ISPsystem team
 
Join Date: Jun 2013
Posts: 233
fly is on a distinguished road
Default

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.
fly is offline   Reply With Quote
Old 02-06-2015, 05:50 PM   #3
Junior Member
 
Join Date: Jan 2015
Posts: 28
mduh is on a distinguished road
Default

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
mduh is offline   Reply With Quote
Old 02-09-2015, 02:57 PM   #4
ISPsystem team
 
Join Date: Jun 2013
Posts: 233
fly is on a distinguished road
Default

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.
fly is offline   Reply With Quote
Old 02-10-2015, 10:24 PM   #5
Junior Member
 
Join Date: Jan 2015
Posts: 28
mduh is on a distinguished road
Default

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!
mduh is offline   Reply With Quote
Old 02-11-2015, 09:46 AM   #6
ISPsystem team
 
Join Date: Jun 2013
Posts: 233
fly is on a distinguished road
Default

I was glad to help you )
fly is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:40 PM.