I’m learning ISPConfig and want to create a plugin. The idea is to allow some additional actions when creating a new website. To achieve this, I need to add a checkbox to the form. I found that there are events 'sites:web_vhost_domain: on_before_formdef' and 'sites:web_vhost_domain: on_after_formdef'. In the onLoad method, I’m trying to register an event handler. PHP: public function onLoad(): void { global $app; $app->plugin->registerEvent('sites:web_vhost_domain:on_before_formdef', $this->plugin_name, 'test'); } However, the log shows the message: 'Unable to register function 'on_before_formdef' from plugin 'z_myfirst_plugin' for event 'sites:web_vhost_domain: on_before_formdef'' I’m trying to figure this out and I see that in the 'plugins' class, in the 'registerEvent' method, this event is not registered in the 'available_events' property. Therefore, the handler is not being registered. Am I doing something wrong, or is it currently not possible to subscribe to this event? Also, in my opinion, it would be great if the message indicated that the event does not exist (to help understand the cause of the issue). Thnx
First, log out and log in again once you created your plugin or subscribed to a new event, as events for a user are cached in his session. Then check the tform_base.inc.php file of the ISPConfig version that you are using to see if it has the mentioned events in the loadFormDef($file, $module = '') { function: Code: .... $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$form['name'] . ':on_before_formdef', $this); ..... $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'] . ':on_after_formdef', $this); .....
You can find some example code here on how to use these events: https://github.com/mediabox-cl/ispc...nterface/lib/plugins/nextcloud_plugin.inc.php