Execute custom script on specific AcyMailing actions

This page lists the most commonly used code triggers used in custom add-ons for AcyMailing

Triggers/hooks on specific actions

To be able to use AcyMailing triggers, you first need to create a custom add-on:

Making a custom add-on

Once created, you can add the following methods in the plugin.php file of your add-on. They will be automatically called by AcyMailing if your add-on is active.

When a user is created

You can use these methods to execute specific actions before/after a user is created.

public function onAcymBeforeUserCreate(&$user) {
    // Your code here, $user is an object containing the AcyMailing user information
}

public function onAcymAfterUserCreate(&$user) {
    // Your code here, $user is an object containing the AcyMailing user information
} 

When a user is modified

You can use these methods to execute specific actions before/after a user is modified.

public function onAcymBeforeUserModify(&$user) {
    // Your code here, $user is an object containing the AcyMailing user information
}

public function onAcymAfterUserModify(&$user) {
    // Your code here, $user is an object containing the AcyMailing user information
} 

When users are removed

You can use these methods to execute specific actions before/after one or several users are deleted.

public function onAcymBeforeUserDelete(&$users) {
    // Your code here, $users is an array of AcyMailing user IDs
}

public function onAcymAfterUserDelete(&$users) {
    // Your code here, $users is an array of AcyMailing user IDs
}

When the user is confirmed

public function onAcymAfterUserConfirm(&$user) {
    // Your code here, $user is an object containing the AcyMailing user information
} 

When the user subscribes to a list

This method is called after the user subscribes to one or several lists.

public function onAcymAfterUserSubscribe(&$user, $lists) {
    // Your code here, $lists is an array of list IDs
} 

When the user unsubscribes from a list

This method is called after the user unsubscribes from one or several lists.

public function onAcymAfterUserUnsubscribe(&$userID, $lists) {
    // Your code here, $lists is an array of list IDs
} 

When importing users

These two methods are called before users are imported. The first one is called for each user that is imported.

public function onAcymBeforeUserImport(&$oneUser) {
    // Your code here, $oneUser is a user object
}

public function onAcymUserImport(&$users) {
    // Your code here, $users is an array of user objects
} 

Last updated