Action
uncanny-automator
automator_fluentcrm_status_update
Fires when a FluentCRM contact's status is updated, providing the subscriber and their old status.
add_action( 'automator_fluentcrm_status_update', $callback, 10, 2 );
Description
Fires after a FluentCRM contact's status is updated. Developers can use this hook to trigger custom actions, send notifications, or update other systems based on the subscriber's new and old status. The hook fires once per update.
Usage
add_action( 'automator_fluentcrm_status_update', 'your_function_name', 10, 2 );
Parameters
-
$subscriber(mixed) - The `$subscriber` parameter contains information about the FluentCRM contact whose status has been updated.
-
$old_status(mixed) - This parameter contains the subscriber object, representing the contact whose status has been updated.
Examples
<?php
/**
* Example of how to hook into the 'automator_fluentcrm_status_update' action.
* This example will log the subscriber's new and old status to the WordPress debug log
* whenever a FluentCRM contact's status is updated.
*/
add_action( 'automator_fluentcrm_status_update', function ( $subscriber, $old_status ) {
// Ensure we have a valid subscriber object.
if ( ! $subscriber instanceof FluentCrmModelsContact ) {
return;
}
// Get the new status from the subscriber object.
$new_status = $subscriber->status;
// Log the status update to the WordPress debug log.
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log( sprintf(
'FluentCRM Status Update for Subscriber ID %d: Status changed from "%s" to "%s".',
$subscriber->id,
$old_status,
$new_status
) );
}
// You could add further logic here, such as:
// - Triggering other automations based on the new status.
// - Sending an email notification to the administrator.
// - Updating custom fields in WordPress.
}, 10, 2 ); // Priority 10, accepts 2 arguments.
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/integrations/fluent-crm/helpers/fluent-crm-helpers.php:84
public function do_fluent_crm_actions( $subscriber, $old_status ) {
// Make sure to only trigger once. For some reason, Fluent CRM is triggering this twice.
if ( ! self::$has_run ) {
do_action( 'automator_fluentcrm_status_update', $subscriber, $old_status );
self::$has_run = true;
}
}