API event support

Hello Guys,

Original post : https://www.howtoforge.com/community/threads/working-with-plugin-control-panel-vs-api.86218/

It's appear the API have some event support missing. image

How to try it:

  1. Add error login to your ispconfig vhost (/etc/apache2/sites-enabled/000-ispconfig.vhost)
    • add / edit the line : ErrorLog /var/log/ispconfig/httpd/YourVHOST.DOMAIN.TLS/error.log
  2. Plugin demonstration :
<?php
class exemple_plugin {
 	var $plugin_name = 'exemple_plugin';
 	var $class_name = 'exemple_plugin';

 	function onLoad() {
 		global $app;
 		$app->plugin->registerEvent('mail:mail_user:on_before_insert', 'exemple_plugin', 'fonction_edit');
 		$app->plugin->registerEvent('mail:mail_user:on_before_update', 'exemple_plugin', 'fonction_edit');
 		$app->plugin->registerEvent('mail:mail_user:on_before_delete', 'exemple_plugin', 'fonction_del');
 	}

 	function fonction_edit($event_name, $page_form){
		error_log('You should see this line in the log when you add / edit an email');
 	}

 	function fonction_del($event_name, $page_form){
 		error_log('You should see this line in the log when you remove an email');
 	}

 }
  1. IMPORTANT : Relog into your ISPConfig control panel
  2. Time to try
    1. Go to Ispconfig;
      • Email > Email Mailbox > Select an existing mailbox > Change something > Save
      • When you do that you should see this inside your logfile image
    2. When you make the same change by the API, nothing is wrote inside the logfile.
      • That mean the plugin isn't call by the API.

Also the support of multi event would be great (before/after)

Regards,