• Dear Pleskians! The Plesk Forum will be undergoing scheduled maintenance on Monday, 7th of July, at 9:00 AM UTC. The expected maintenance window is 2 hours.
    Thank you in advance for your patience and understanding on the matter.

Event handler for subscription created

eworksmedia

New Pleskian
Which Event Handler gets fired when a subscription is created? I've tried both "Hosting settings created" and "Default domain (the first domain added to a subscription/webspace) created" but those don't seem to be firing when I create a new subscription. After creating the Event Handler the psa service was restarted each time. I have a script setup to just log the NEW_DOMAIN_NAME to a file, but that isn't happening.
 
I too am experiencing this very same problem. I need to run a script that automates a few things each time a new domain is created for a new subscription, but I can't seem to find the correct event trigger. I've tried a couple, including "Hosting settings created" and "Default domain (the first domain added to a subscription/webspace) created" to no avail.

Has anybody had any luck with this yet? Are there any log files I can look at to see if the event listener is even being triggered?

Cheers,
Pedro
 
This is how I solved it. Save a file like this:

Code:
class MYEventListener_EventListener implements EventListener {
	
	private static $domain_name = '';
	
	public function handleEvent($objectType, $objectId, $action, $oldValues, $newValues) { // called for all Plesk events
		if($action == 'phys_hosting_create'){ // subscription created
			self::$domain_name = $newValues['Domain Name'];
		}
	}
	
}

return new MYEventListener_EventListener();

To
Code:
/usr/local/psa/admin/plib/registry/EventListener/MYEventListener.php
 
Thanks for the quick reply. I eventually found the error. I was a stupid typo in the command field. One of those you read over and over and all is fine in your head, until another person reads it and spots the error... :(
 
Back
Top