Skip to content

ActionHooks

Shahjahan Jewel edited this page Oct 26, 2020 · 5 revisions

FluentCRM trigger action hook on different life-cycle of your contact and other modules.

Contact Specific Actions Hooks

<?php

// New contact created
 do_action('fluentcrm_contact_created', $contact);

// contact updated
do_action('fluentcrm_contact_updated', $contact);

// contact updated
do_action('fluentcrm_contact_updated', $contact);

// Contact added to lists
do_action( 'fluentcrm_contact_added_to_lists', $listIds, $contact);

// Contact removed from
do_action( 'fluentcrm_contact_removed_from_lists', $listIds, $contact);

// Contact added to tags
do_action( 'fluentcrm_contact_added_to_tags', $tagIds, $contact);

// Contact removed from tags
do_action( 'fluentcrm_contact_removed_from_tags', $tagIds, $contact);

// contact status change to subscribed
do_action('fluentcrm_subscriber_status_to_subscribed', $contact, $oldStatus);

// contact status change to unsubscribed
do_action('fluentcrm_subscriber_status_to_unsubscribed', $contact, $oldStatus);

Example Usage

<?php

// Do something after contact is added
add_action('fluentcrm_contact_created', function ($contact) {
    // do your stuff here
}, 10, 1);

// Do something after a contact get updated
add_action('fluentcrm_contact_updated', function ($contact) {
    // do your stuff here
}, 10, 1);


// Do something after a contact status changed to subscribed
add_action('fluentcrm_subscriber_status_to_subscribed', function ($contact, $oldStatus) {
    // do your stuff here
}, 10, 2);
Clone this wiki locally