Last active
June 14, 2021 12:58
-
-
Save techjewel/9acdaf1f95fa088de688e2e97811b0a8 to your computer and use it in GitHub Desktop.
FluentCRM update contact status programatically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function fcrmUpdateContactStatus($contactEmail, $newStatus) { | |
$contact = FluentCrmApi('contacts')->getContact($contactEmail); | |
if($contact) { | |
$oldStatus = $contact->status; | |
if($newStatus != $oldStatus) { | |
$contact->status = $newStatus; | |
$contact->save(); | |
do_action('fluentcrm_subscriber_status_to_' . $newStatus, $contact, $oldStatus); | |
} | |
} | |
return $contact; | |
} | |
// example usage: fcrmUpdateContactStatus('contact@email.com', 'unsubscribed'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment